use switch and filter vol better

This commit is contained in:
2025-12-21 01:29:12 -08:00
parent b357d07a2a
commit b2ab7e1ad6
2 changed files with 17 additions and 12 deletions

View File

@ -1,7 +1,9 @@
#!/bin/sh
VOLUME=$(wpctl get-volume @DEFAULT_SINK@)
if [ $VOLUME =~ "MUTED" ]; then
echo " MUTED"
fi
VOLUME=$(echo $VOLUME | sed s/"Volume: 0."//g)
echo " $VOLUME"
case $VOLUME in
*MUTED*)
echo " MUTED";;
*)
VOLUME=$(echo $VOLUME | awk '{print $2}' | sed 's/^0//;s/\.//')
echo " $VOLUME";;
esac