language-independent volume script

This commit is contained in:
Luke Smith 2020-04-14 21:45:09 -04:00
parent 314ff058de
commit 54f691a078
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -23,7 +23,7 @@ volstat="$(pactl list sinks)"
echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit
# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA # echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA
vol="$(echo "$volstat" | grep '^[[:space:]]Volume:' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA # vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA
if [ "$vol" -gt "70" ]; then if [ "$vol" -gt "70" ]; then