Files
hypr/scripts/makropad/button01.sh
T
2026-06-26 23:06:50 +02:00

38 lines
1012 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
hyprctl dispatch "hl.dsp.focus({window = '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
hyprctl dispatch "hl.dsp.focus({window = 'address:$ACTIVE_WIN'})"
fi
hyprctl notify 1 500 0 "Row 1, Colums 1"