dotfiles/home/dot_config/xmobar/executable_volume
2023-05-20 09:16:45 -07:00

13 lines
447 B
Plaintext

sink=$( pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1 )
volume=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' )
mute=$(pactl list sinks | grep '^[[:space:]]Mute:' | head -n $(( $SINK + 1 )) | tail -n 1 | awk '{print $2}')
if [ "$mute" == "yes" ]; then
color="#f92672"
else
color="#a6e22e"
fi
echo "<fc=$color> $volume%</fc>"