]> git.sev.monster Git - dotfiles.git/blob - bin/tint2-alsa
update firefox theming
[dotfiles.git] / bin / tint2-alsa
1 #!/bin/sh
2 base=~/.icons/Paper-Mono-Dark/24x24/panel/audio-volume
3   high=$base-high.svg
4 medium=$base-medium.svg
5    low=$base-low.svg
6  muted=$base-muted.svg
7
8 ident="iface=MIXER,name=Master Playback Volume"
9 eval $(amixer cget "$ident" | grep -o 'max=\d\+')
10
11 while true; do
12         # XXX: assume mono, could be different
13         vol=$(amixer get Master | grep 'Mono:')
14         mute=$(echo "$vol" | cut -d ' ' -f 8)
15         vol=$(expr $(echo "$vol" | cut -d ' ' -f 5) \* 100 / $max \* 100 / 100)
16         if [ $mute = '[off]' ]; then
17                 echo $muted
18         elif [ $vol -ge 75 ]; then
19                 echo $high
20         elif [ $vol -ge 50 ]; then
21                 echo $medium
22         elif [ $vol -ge 25 ]; then
23                 echo $low
24         else
25                 echo $muted
26         fi
27         sleep 2
28 done
This page took 0.042861 seconds and 4 git commands to generate.