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

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Toggle Discord "Deafen" (mutes mic and audio output)
# Dependencies: hyprctl, jq, wtype
# Check if Discord is running
if ! pgrep -x "Discord" > /dev/null; then
echo "Discord is not running."
exit 1
fi
# Get currently active window address
ACTIVE_WIN=$(hyprctl activewindow -j | jq -r '.address')
# Find Discord's window address
DISCORD_WIN=$(hyprctl clients -j | jq -r '.[] | select(.class == "discord") | .address')
if [ -z "$DISCORD_WIN" ]; then
echo "Discord window not found."
exit 1
fi
# Focus the Discord window
hyprctl dispatch focuswindow address:$DISCORD_WIN
# Give Discord time to focus
sleep 0.1
# Send Ctrl + Shift + D to toggle "Deafen"
wtype -M ctrl -M shift -k D -m shift -m ctrl
# Optional: Restore focus to the previous window
if [ -n "$ACTIVE_WIN" ]; then
sleep 0.1
hyprctl dispatch focuswindow address:$ACTIVE_WIN
fi
# Add shared script Functions
source "$HOME/.config/function_helper.sh"
send_notification "low" "Pressed Makropad Button" "Row 2, Colums 1" "$HOME/.icons/BeautyLine-Garuda/apps/scalable/keyboard.svg"