summaryrefslogtreecommitdiffstats
path: root/.local/bin/status/sb-volume
blob: bc1ca970ca84563df03997a5a510453fba9776e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

[ $(hostname -s) = "mars" ] || return

vol="$(mixer vol | awk '{print $7}' | cut -d ':' -f1)"

if [ "$vol" -gt "0" ]; then
	icon=""
else
	icon="婢"
fi

mic="$(mixer rec | awk '{print $7}' | cut -d ':' -f1)"

if [ "$mic" -gt "0" ]; then
	micon=""
else
	micon=""
fi

echo -n "$micon  $icon "

case $(echo $vol / 12.5 | bc) in
	"0") printf "[        ]";;
	"1") printf "[=       ]";;
	"2") printf "[==      ]";;
	"3") printf "[===     ]";;
	"4") printf "[====    ]";;
	"5") printf "[=====   ]";;
	"6") printf "[======  ]";;
	"7") printf "[======= ]";;
	"8") printf "[========]";;
esac