Files
hyprland-dotfiles/.config/hypr/scripts/makropad/button01.sh
2025-10-16 20:50:11 +02:00

36 lines
875 B
Bash
Executable File

#!/bin/bash
# Dependencies: hyprctl, jq, wtype
# Make sure Discord is running
if ! pgrep -x "Discord" > /dev/null; then
echo "Discord is not running."
exit 1
fi
# Get the active window before switching (optional)
ACTIVE_WIN=$(hyprctl activewindow -j | jq -r '.address')
# Find the address of the Discord window
DISCORD_WIN=$(hyprctl clients -j | jq -r '.[] | select(.class == "discord") | .address')
if [ -z "$DISCORD_WIN" ]; then
echo "Could not find Discord window."
exit 1
fi
# Focus Discord
hyprctl dispatch focuswindow address:$DISCORD_WIN
# Give it a moment to receive focus
sleep 0.1
# Send Ctrl+Shift+M to toggle mute
wtype -M ctrl -M shift -k M -m shift -m ctrl
# (Optional) Return to previous window
if [ -n "$ACTIVE_WIN" ]; then
sleep 0.1
hyprctl dispatch focuswindow address:$ACTIVE_WIN
fi
hyprctl notify 1 500 0 "Row 1, Colums 1"