]> git.sev.monster Git - dotfiles.git/blame - bin/tint2-alsa
update submodules, remove bsd shims, fix bugs
[dotfiles.git] / bin / tint2-alsa
CommitLineData
dcac60d9 1#!/bin/sh
2base=~/.icons/Paper-Mono-Dark/24x24/panel/audio-volume
3 high=$base-high.svg
4medium=$base-medium.svg
5 low=$base-low.svg
6 muted=$base-muted.svg
7
8ident="iface=MIXER,name=Master Playback Volume"
9eval $(amixer cget "$ident" | grep -o 'max=\d\+')
10
11while 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
28done
This page took 0.031972 seconds and 4 git commands to generate.