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