From 98ea4e0080fd6f05485baa485cefe2fd7fea9fa2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 6 Feb 2023 17:05:16 -0500 Subject: [PATCH] fix #1260, more principled volume format --- .local/bin/statusbar/sb-volume | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index 52999f4..acdf7a9 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -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="🔊" ;;