summaryrefslogtreecommitdiff
path: root/i3blocks-audio.sh
blob: 84f883d968b30e3c64467ddd3e7fbf431b220923 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
low=25
mid=50
high=75
icon_low=󰕿
icon_mid=󰖀
icon_high=󰕾
icon_mute=󰝟

[ $(pulsemixer --get-mute) -eq 1 ] && printf "$icon_mute\n" && exit

volume=$(pulsemixer --get-volume | cut -d' ' -f1)
icon=
[ $volume -lt $low ] && icon=$icon_low
[ $volume -ge $low ] && [ $volume -lt $high ] && icon=$icon_mid
[ $volume -ge $high ] && icon=$icon_high
printf "%s %s%%\n" $icon $volume