diff --git a/i3/config.m4 b/i3/config.m4 index 6bc2207..88d7c21 100644 --- a/i3/config.m4 +++ b/i3/config.m4 @@ -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 diff --git a/toggle_mute.sh b/toggle_mute.sh new file mode 100755 index 0000000..52dcb70 --- /dev/null +++ b/toggle_mute.sh @@ -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