tNow beep put the sound on - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit e9a6176d1249f8783c1769570ebfceec39eecd73
 (DIR) parent 37251e5a3f673d3bcf147f4f11c922157ce3482c
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Thu,  3 Apr 2014 10:37:01 +0200
       
       Now beep put the sound on
       
       Diffstat:
         M battery.sh                          |      19 ++++++++++++++++---
       
       1 file changed, 16 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/battery.sh b/battery.sh
       t@@ -8,7 +8,20 @@ BATS=`cat /sys/class/power_supply/BAT1/status`
        
        # Run this if sound is enabled
        sbell () { 
       +    IFS=' %' read level state <<< `~/bin/volume`
       +
       +    ~/bin/volume unmute
       +    ~/bin/volume '80%'
       +
            beep -f 1000 -l 200 -D 50
       +
       +    case $state in
       +        on) ~/bin/volume unmute;;
       +        off) ~/bin/volume mute;;
       +    esac
       +
       +    # reset volume to its previous state
       +    ~/bin/volume "${level}%"
        }
        
        # and this in case of no sound enabled
       t@@ -35,8 +48,8 @@ test "$#" -lt 3 && usage
        # if battery is charging, do not alert user
        test "$BATS" == "Charging" && exit
        
       -test $BATC -lt $1 && sbell  # one bip for level <low>
       -test $BATC -lt $2 && sbell  # two bip for level <critical>
       -test $BATC -lt $3 && sbell  # battery is <dead>, bip 3 times
       +test $BATC -lt $1 && sbell # one bip for level <low>
       +test $BATC -lt $2 && sbell # two bip for level <critical>
       +test $BATC -lt $3 && sbell # battery is <dead>, bip 3 times
        
        test $BATC -lt $1 && vbell # popup a notification under <low> level