Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #DESKTOP=:0 # need for notifications run 'over' display
- mixer_state=$(amixer get Master | awk '$1=="Mono:" {print $6}')
- x=$(amixer get Master | sed -rn "/[^[]+\[/{s///;s/%.+//p;q}")
- z=$[x/10]; y='◼◼◼◼◼◼◼◼◼◼'
- zz=$[10-z];yy='◻◻◻◻◻◻◻◻◻◻'
- # get current screen resoultion
- curres=$(xdpyinfo | grep dimensions | awk '{print $2}')
- # calculate current max x
- curmx=$(echo $curres | sed 's/x.*$//')
- # calculate current max y
- curmy=$(echo $curres | sed 's/^.*x//')
- poffset=0
- notify_title="Volume"
- case $x in
- 0*|?|1?) notify_icon="notification-audio-volume-off";;
- 2?|3?|4?) notify_icon="notification-audio-volume-low";;
- 5?|6?|7?) notify_icon="notification-audio-volume-medium";;
- 8?|9?|100) notify_icon="notification-audio-volume-high";;
- esac
- if [ $mixer_state == "[off]" ];then
- notify_icon="notification-audio-volume-muted"
- notify_title="$notify_title muted"
- fi
- notify-send -i $notify_icon -t 1500 -u low -h int:x:$[$curmx-$poffset] -h \
- int:y:$[$curmy-$poffset] "$notify_title" "${y::z}${yy::zz} $x%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement