*nohtml*

local/bin/volume

   1 #!/bin/bash
   2 
   3 get(){ # {{{
   4     grep -o '[0-9]*%' | head -n 1 | tee ~/.cache/volume
   5 } # }}}
   6 
   7 a=$(amixer get Master | get)
   8 [[ ! $1 ]] && echo $a && exit
   9 
  10 b=$(amixer set Master $1 unmute | get)
  11 [[ $a != $b ]] && beeper bubble
  12 
  13 i=high
  14 c=${b//%}
  15 
  16 (( $c < 65 )) && i=medium
  17 (( $c < 35 )) && i=low
  18 (( $c <  1 )) && i=muted
  19 
  20 gdbus call --session \
  21 --dest org.freedesktop.Notifications \
  22 --object-path /org/freedesktop/Notifications \
  23 --method org.freedesktop.Notifications.Notify \
  24 volume 1000 audio-volume-$i-symbolic "Громкость $b" '' [] {} 1000 >&-