fix #1260, more principled volume format
This commit is contained in:
parent
070c613050
commit
98ea4e0080
1 changed files with 3 additions and 2 deletions
|
@ -19,14 +19,15 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||||
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
|
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
|
||||||
|
|
||||||
vol="${vol#Volume: }"
|
vol="${vol#Volume: }"
|
||||||
|
|
||||||
split() {
|
split() {
|
||||||
# For ommiting the . without calling and external program.
|
# For ommiting the . without calling and external program.
|
||||||
IFS=$2
|
IFS=$2
|
||||||
set -- $1
|
set -- $1
|
||||||
printf '%s' "$@"
|
printf '%s' "$@"
|
||||||
}
|
}
|
||||||
vol="$(split "$vol" ".")"
|
|
||||||
vol="${vol##0}"
|
vol="$(printf "%.0f" "$(split "$vol" ".")")"
|
||||||
|
|
||||||
case 1 in
|
case 1 in
|
||||||
$((vol >= 70)) ) icon="🔊" ;;
|
$((vol >= 70)) ) icon="🔊" ;;
|
||||||
|
|
Loading…
Reference in a new issue