fix #1260, more principled volume format

This commit is contained in:
Luke Smith 2023-02-06 17:05:16 -05:00
parent 070c613050
commit 98ea4e0080
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -19,14 +19,15 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
vol="${vol#Volume: }"
split() {
# For ommiting the . without calling and external program.
IFS=$2
set -- $1
printf '%s' "$@"
}
vol="$(split "$vol" ".")"
vol="${vol##0}"
vol="$(printf "%.0f" "$(split "$vol" ".")")"
case 1 in
$((vol >= 70)) ) icon="🔊" ;;