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

volume=$(mixer vol | cut -d':' -f2)
icon=
[ $volume -eq 0 ] && icon=$icon_mute
[ $volume -gt 0 ] && [ $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