dotfiles/_desktop/_scripts/sb-volume

16 lines
744 B
Plaintext
Raw Normal View History

2022-07-30 01:02:25 +02:00
#!/bin/bash
2022-09-26 19:59:29 +02:00
if [ $1 ]; then
case $1 in
inc) pactl set-sink-volume @DEFAULT_SINK@ +5%;;
dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;;
esac
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
notify-send -u low "volume: $volume"
2022-09-26 19:59:29 +02:00
else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="\uf131" || micmute=""
2022-09-26 19:59:29 +02:00
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && printf "${micmute} \ufc5d" || printf "$micmute"
2022-09-26 19:59:29 +02:00
fi