#!/bin/bash sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*') cmd="" app="pavucontrol" if [ -z "$sink" ]; then echo "ERROR: invalid sink: \"$sink\"" exit 1 fi function _toggle() { a=$1 if [ $(pgrep $a) ]; then killall $a else $a &> /dev/null & fi } case $1 in d*) pactl set-sink-volume $sink -5% ;; i*) pactl set-sink-volume $sink +5% ;; m*) pactl set-sink-mute $sink toggle ;; gui) _toggle $app ;; *) echo "ERROR: invalid command: \"$1\"" ;; esac