volume bar more efficient
This commit is contained in:
parent
2e7fc9cfb7
commit
28a57eb59e
1 changed files with 19 additions and 11 deletions
|
@ -13,18 +13,26 @@ case $BLOCK_BUTTON in
|
||||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ $(pamixer --get-mute) = true ] && echo 🔇 && exit
|
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||||
|
|
||||||
vol="$(pamixer --get-volume)"
|
# If muted, print 🔇 and exit.
|
||||||
|
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
|
||||||
|
|
||||||
if [ "$vol" -gt "70" ]; then
|
vol="${vol#Volume: }"
|
||||||
icon="🔊"
|
split() {
|
||||||
elif [ "$vol" -gt "30" ]; then
|
# For ommiting the . without calling and external program.
|
||||||
icon="🔉"
|
IFS=$2
|
||||||
elif [ "$vol" -gt "0" ]; then
|
set -- $1
|
||||||
icon="🔈"
|
printf '%s' "$@"
|
||||||
else
|
}
|
||||||
echo 🔇 && exit
|
vol="$(split "$vol" ".")"
|
||||||
fi
|
vol="${vol##0}"
|
||||||
|
|
||||||
|
case 1 in
|
||||||
|
$((vol >= 70)) ) icon="🔊" ;;
|
||||||
|
$((vol >= 30)) ) icon="🔉" ;;
|
||||||
|
$((vol >= 1)) ) icon="🔈" ;;
|
||||||
|
* ) echo 🔇 && exit ;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "$icon$vol%"
|
echo "$icon$vol%"
|
||||||
|
|
Loading…
Reference in a new issue