Implemented volume toggle

This commit is contained in:
Enrico Fasoli 2015-08-26 10:55:03 +00:00
parent 5d56266be4
commit c6ee0e032e
3 changed files with 8 additions and 2 deletions

6
bin/togglemute.sh Executable file
View File

@ -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

View File

@ -3,7 +3,7 @@ buildClock() {
} }
getVolume() { 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(){ getMPD(){

View File

@ -94,7 +94,7 @@ XF86AudioRaiseVolume
XF86AudioLowerVolume XF86AudioLowerVolume
amixer set Master 3- unmute amixer set Master 3- unmute
XF86AudioMute XF86AudioMute
amixer set Master mute sh ~/bin/togglemute.sh
XF86AudioPlay XF86AudioPlay
amixer set Master unmute amixer set Master unmute
XF86HomePage XF86HomePage