Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # pulseaudio volume controller
- # written by Geyslan G. Bem
- #
- script=$(basename "$0")
- sinks=$(pacmd list-sinks | awk '/index: / { gsub(/*/, "", $0); print $2 }')
- opt=$1
- vol=${2:-5}
- usage() {
- echo -e "usage: $script [options]
- where options are:
- vol-up [%]\tincrease volume % (default: 5%)
- vol-down [%]\tdecrease volume in % (default: 5%)
- toggle\ttoggle mute/unmute"
- }
- for sink in $sinks
- do
- case $opt in
- vol-up)
- pactl set-sink-volume $sink +$vol%
- ;;
- vol-down)
- pactl set-sink-volume $sink -$vol%
- ;;
- toggle)
- pactl set-sink-mute $sink toggle
- ;;
- *)
- usage
- exit 0
- ;;
- esac
- done
- muted=$(pactl list sinks | awk '/Mute: yes/ { print $2; exit }')
- case $opt in
- vol-up)
- notify-send -i audio-volume-high "Volume increased"
- ;;
- vol-down)
- notify-send -i audio-volume-low "Volume decreased"
- ;;
- toggle)
- if [ "$muted" == "yes" ]; then
- notify-send -i audio-volume-muted "Sound muted"
- else
- notify-send -i audio-volume-medium-symbolic "Sound unmuted"
- fi
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement