config_sway/bin/volume

23 lines
377 B
Bash
Executable file

#!/bin/bash
sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*')
cmd=""
if [ -z "$sink" ]; then
echo "ERROR: invalid sink: \"$sink\""
exit 1
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
;;
*)
echo "ERROR: invalid command: \"$1\""
;;
esac