From 5e40304e58dc41e48e728576b7c9004527d3e179 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sat, 20 Sep 2025 00:23:35 -0400 Subject: [PATCH] eww: use awk for getVolume zero padding --- home-manager/progs/eww/config/scripts/sound/getVolume.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/home-manager/progs/eww/config/scripts/sound/getVolume.sh b/home-manager/progs/eww/config/scripts/sound/getVolume.sh index e5a44ab..13c42de 100755 --- a/home-manager/progs/eww/config/scripts/sound/getVolume.sh +++ b/home-manager/progs/eww/config/scripts/sound/getVolume.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash output=$(wpctl get-volume @DEFAULT_SINK@ | cut -d' ' -f2- | sed -E 's/\.//g' | sed 's/^0*//g') -count=$(echo "$output" | cut -d' ' -f1) +count=$(echo "$output" | awk -F, '{print $1+0}') muted=$(echo "$output" | cut -d'[' -f2 | cut -d ']' -f1) # if not muted, set to empty string @@ -8,11 +8,6 @@ if [ "$muted" == "$count" ]; then muted="" fi -# fix removal of zero padding if volume is zero -if [ "$count" == "" ]; then - count="0" -fi - color="green" if ((count > 75)); then color="yellow"; fi if ((count > 90)); then color="peach"; fi