]> git.sev.monster Git - dotfiles.git/blame_incremental - bin/tint2-alsa
zprofile: remove unnecessary variable
[dotfiles.git] / bin / tint2-alsa
... / ...
CommitLineData
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
8# TODO: doesn't work if no master mixer, eg usb dac
9ident="iface=MIXER,name=Master Playback Volume"
10eval $(amixer cget "$ident" | grep -o 'max=\d\+')
11
12while true; do
13 # XXX: assume mono, could be different
14 vol=$(amixer get Master | grep 'Mono:')
15 mute=$(echo "$vol" | cut -d ' ' -f 8)
16 vol=$(expr $(echo "$vol" | cut -d ' ' -f 5) \* 100 / $max \* 100 / 100)
17 if [ $mute = '[off]' ]; then
18 echo $muted
19 elif [ $vol -ge 75 ]; then
20 echo $high
21 elif [ $vol -ge 50 ]; then
22 echo $medium
23 elif [ $vol -ge 25 ]; then
24 echo $low
25 else
26 echo $muted
27 fi
28 sleep 2
29done
This page took 0.032996 seconds and 4 git commands to generate.