*nohtml*

local/bin/volume

   1 #!/bin/bash
   2 
   3 value(){ # {{{
   4     grep -om 1 '[0-9]*%' | tee ~/.cache/volume
   5 } # }}}
   6 
   7 vol=$1
   8 get=$(amixer get Master | value)
   9 
  10 [[ ! $vol ]] && echo $get && exit
  11 [[ $vol == +* ]] && vol=${vol:1}+
  12 [[ $vol == -* ]] && vol=${vol:1}-
  13 
  14 set=$(amixer set Master $vol unmute | value)
  15 [[ $get != $set ]] && aplay ~/.local/share/sounds/bubble.wav 2>&- &
  16 
  17 ico=high
  18 vol=${set:0:-1}
  19 
  20 (( $vol < 65 )) && ico=medium
  21 (( $vol < 35 )) && ico=low
  22 (( $vol <  1 )) && ico=muted
  23 
  24 notify-send -a volume -i audio-volume-$ico-symbolic -- "Громкость $set"