From 2cb468f9a592cae0bacfe199b0be710ef33476c9 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 12 Apr 2022 23:15:05 +0300 Subject: [PATCH] feat(prog/xmobar): add support muted --- programs/xmonad/xmobar/scripts/get_volume.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/xmonad/xmobar/scripts/get_volume.sh b/programs/xmonad/xmobar/scripts/get_volume.sh index 5673405..50540bd 100755 --- a/programs/xmonad/xmobar/scripts/get_volume.sh +++ b/programs/xmonad/xmobar/scripts/get_volume.sh @@ -1,3 +1,9 @@ #!/bin/bash -echo $(amixer -D pulse sget Master | egrep -o "[0-9]+%" | head -n 1) +res=$(amixer -D pulse sget Master) +enabled=$(echo $res | egrep -o "\[on\]" | wc -l) +if [[ $enabled == "0" ]]; then + echo "off" +else + echo $(echo $res | egrep -o "[0-9]+%" | head -n 1) +fi exit 0