#!/bin/sh # script wish show Volume control using notify-send, for LXDE # Author : Jean-Charles Siegel # E-mail : jean-ch@rles-siegel.fr # Date : 2011-12-22 # Notification Time To Live in ms TTL=1000 # Notification Title TITLE="Volume" case $1 in "more") amixer set Master 5%+ NAME=$1 ;; "less") amixer set Master 5%- NAME=$1 ;; "toggle") amixer set Master toggle NAME=`amixer get Master|tail -n 1|awk -F" " '{print $7;}'|grep -E "[0-9]*"|sed "s/\[//"|sed "s/\]//"` ;; "help") echo "This is help for my-volume command. Command : my-volume param" echo "List of params : " echo " * more : increase volume" echo " * less : decrease volume" echo " * toggle : set volume on or off" echo " * help : these lines" ;; *) echo "Usage my-volume more|less|toggle|help" ;; esac LEVEL=`amixer get Master|tail -n 1|awk -F" " '{print $5;}'|grep -E "[0-9]*"|sed "s/\[//"|sed "s/\]//"|sed "s/\%//"` STATUT=`amixer get Master|tail -n 1|awk -F" " '{print $7;}'|grep -E "[0-9]*"|sed "s/\[//"|sed "s/\]//"` DECIBEL=`amixer get Master|tail -n 1|awk -F" " '{print $6;}'|grep -E "[0-9]*"|sed "s/\[//"|sed "s/\]//"` LOOP=`expr $LEVEL / 5` LOOP2=`expr 20 - $LOOP` BAR="[" for i in `seq 1 $LOOP` do BAR="$BAR+" done for i in `seq 1 $LOOP2` do BAR=$BAR"=" done BAR="$BAR]" case $1 in "more"|"less"|"toggle") notify-send -i /home/yote/Images/Icons/volume-$NAME.png -t $TTL "$TITLE : $STATUT $DECIBEL" "$BAR $LEVEL%" ;; *) ;; esac exit 1