dotfiles/bin/executable_get-volume.sh

14 lines
356 B
Bash
Raw Normal View History

2023-02-25 16:18:35 +00:00
#!/bin/bash
muted=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F ' ' '{print $2}')
if [ $muted == "yes" ]; then
echo "{\"alt\": \"mute\", \"class\": \"muted\", \"tooltip\": \"muted\"}"
exit
fi
VOL=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk -F' ' '{print $5}' | sed -e 's/%$//')
echo "{\"percentage\": $VOL, \"tooltip\": \"$VOL%\"}"