system/programs/xmonad/xmobar/scripts/get_volume.sh

10 lines
208 B
Bash
Raw Normal View History

#!/bin/bash
2022-04-12 23:15:05 +03:00
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