Mute toggle script.

This commit is contained in:
Gabriel Ebner 2021-02-19 10:26:35 +01:00
parent 0cfa89ded5
commit ccf2a01944
2 changed files with 17 additions and 0 deletions

View File

@ -72,6 +72,8 @@ bindsym Shift+XF86MonBrightnessDown exec light -U 1
bindsym Shift+XF86MonBrightnessUp exec light -A 1
])
bindsym Print exec ~/etc/toggle_mute.sh
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode

15
toggle_mute.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
if pacmd dump | grep -v monitor | grep -q '^set-source-mute .* no$'; then
mute=yes
else
mute=no
fi
pacmd dump | sed "/monitor/d;/^set-source-mute /!d;s/ \(no\|yes\)$/ $mute/" | pacmd
if [ "$mute" = "yes" ]; then
notify-send -u normal -t 1000 muted
else
notify-send -u critical -t 1000 UNMUTED
fi