Merge branch 'master' of ssh://git.jonathanh.co.uk:2222/jab2870/Dotfiles

master
Jonathan Hodgson 4 years ago
commit 66a3424fb5
  1. 21
      bin/.bin/volume

@ -24,17 +24,34 @@ function drawBar(){
case "$1" in case "$1" in
"up") "up")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl up
else
amixer -q -D default sset Master 5%+ unmute amixer -q -D default sset Master 5%+ unmute
fi
;; ;;
"down") "down")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl down
else
amixer -q -D default sset Master 5%- unmute amixer -q -D default sset Master 5%- unmute
fi
;; ;;
"toggle") "toggle")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl mute
else
amixer -q -D default sset Master toggle amixer -q -D default sset Master toggle
fi
esac esac
volume="$(amixer -D default sget Master | grep -o '\[.*\%' | head -n 1 | tr -d '[%')" if type -p pulseaudio-ctl 2> /dev/null; then
speakerStatus="$(amixer -D default sget Master | grep -o '\[\(on\|off\)' | head -n 1 | tr -d '[')" volume="$(pulseaudio-ctl full-status | cut -d ' ' -f1)"
speakerStatus="$(pulseaudio-ctl full-status | cut -d ' ' -f2 | sed 's/no/on/g')"
else
volume="$(amixer -D default sget Master | grep -o '\[.*\%' | head -n 1 | tr -d '[%')"
speakerStatus="$(amixer -D default sget Master | grep -o '\[\(on\|off\)' | head -n 1 | tr -d '[')"
fi
if [[ "$speakerStatus" == "on" ]]; then if [[ "$speakerStatus" == "on" ]]; then

Loading…
Cancel
Save