diff --git a/bin/togglemute.sh b/bin/togglemute.sh new file mode 100755 index 0000000..c880d62 --- /dev/null +++ b/bin/togglemute.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if [ "$(amixer get Master | cut -d$'\n' -f 5 | cut -d ' ' -f 8)" == "[on]" ]; then + amixer set Master mute +else + amixer set Master unmute +fi diff --git a/lemonbar.sh b/lemonbar.sh index 7073c74..61d363f 100755 --- a/lemonbar.sh +++ b/lemonbar.sh @@ -3,7 +3,7 @@ buildClock() { } getVolume() { - echo -n "$(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)%%" + echo -n "$(amixer get Master | cut -d$'\n' -f 5 | cut -d ' ' -f 8) $(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)%%" } getMPD(){ diff --git a/sxhkdrc b/sxhkdrc index 9875559..f465add 100755 --- a/sxhkdrc +++ b/sxhkdrc @@ -94,7 +94,7 @@ XF86AudioRaiseVolume XF86AudioLowerVolume amixer set Master 3- unmute XF86AudioMute - amixer set Master mute + sh ~/bin/togglemute.sh XF86AudioPlay amixer set Master unmute XF86HomePage