#!/bin/sh base=~/.icons/Paper-Mono-Dark/24x24/panel/audio-volume high=$base-high.svg medium=$base-medium.svg low=$base-low.svg muted=$base-muted.svg ident="iface=MIXER,name=Master Playback Volume" eval $(amixer cget "$ident" | grep -o 'max=\d\+') while true; do # XXX: assume mono, could be different vol=$(amixer get Master | grep 'Mono:') mute=$(echo "$vol" | cut -d ' ' -f 8) vol=$(expr $(echo "$vol" | cut -d ' ' -f 5) \* 100 / $max \* 100 / 100) if [ $mute = '[off]' ]; then echo $muted elif [ $vol -ge 75 ]; then echo $high elif [ $vol -ge 50 ]; then echo $medium elif [ $vol -ge 25 ]; then echo $low else echo $muted fi sleep 2 done