Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- volume=$(amixer sget Master | grep -o -m 1 '[[:digit:]]*%' | tr -d '%')
- if [ -n "$2" ]
- then
- percent_change=$2
- else
- percent_change=5
- fi
- case "$1" in
- up)
- volume=$((volume + percent_change))
- if [ $volume -gt 100 ]
- then
- volume=100
- fi
- amixer sset Master $volume% unmute
- ;;
- down)
- volume=$((volume - percent_change))
- if [ $volume -lt 0 ]
- then
- volume=0
- fi
- amixer sset Master $volume% unmute
- ;;
- set)
- volume=$2
- amixer sset Master $volume% unmute
- ;;
- toggle)
- amixer sset Master toggle
- ;;
- mute)
- amixer sset Master mute
- ;;
- unmute)
- amixer sset Master unmute
- ;;
- esac
- echo $volume
- if [ -n "$(amixer sget Master | grep -o -m 1 'off')" ]
- then
- notify-send " " -i "/usr/share/icons/Numix/24x24/status/audio-volume-muted-panel.svg" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
- elif [ "$volume" -eq "0" ]
- then
- notify-send " " -i "/usr/share/icons/Numix/24x24/status/audio-volume-low-zero-panel.svg" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
- elif [ "$volume" -le "33" ]
- then
- notify-send " " -i "/usr/share/icons/Numix/24x24/status/audio-volume-low-panel.svg" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
- elif [ "$volume" -lt "66" ]
- then
- notify-send " " -i "/usr/share/icons/Numix/24x24/status/audio-volume-medium-panel.svg" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
- else
- notify-send " " -i "/usr/share/icons/Numix/24x24/status/audio-volume-high-panel.svg" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement