2020-12-22 17:04:22 +01:00
|
|
|
#!/bin/bash
|
2021-01-04 18:46:33 +01:00
|
|
|
source $HOME/.config/sway/bin/sway_helpers
|
2021-02-03 12:16:47 +01:00
|
|
|
SINK=$(pactl info | grep "Default Sink" | cut -d ' ' -f 3)
|
2021-01-04 18:27:42 +01:00
|
|
|
APP="pavucontrol"
|
2021-01-20 17:19:39 +01:00
|
|
|
SOUND=$HOME/.config/sway/bin/drip.ogg
|
2020-12-22 17:04:22 +01:00
|
|
|
|
2021-01-04 18:27:42 +01:00
|
|
|
## helpers
|
2021-01-04 17:37:20 +01:00
|
|
|
function _toggle() {
|
|
|
|
a=$1
|
|
|
|
if [ $(pgrep $a) ]; then
|
|
|
|
killall $a
|
|
|
|
else
|
|
|
|
$a &> /dev/null &
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-01-04 18:27:42 +01:00
|
|
|
## main
|
|
|
|
if [ -z "$SINK" ]; then
|
|
|
|
_log VOLUME ERROR args: $*
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-12-22 17:04:22 +01:00
|
|
|
case $1 in
|
|
|
|
d*)
|
2021-01-04 18:27:42 +01:00
|
|
|
pactl set-sink-volume $SINK -5%
|
2021-02-03 12:16:47 +01:00
|
|
|
paplay $SOUND &
|
2020-12-22 17:04:22 +01:00
|
|
|
;;
|
|
|
|
i*)
|
2021-01-04 18:27:42 +01:00
|
|
|
pactl set-sink-volume $SINK +5%
|
2021-02-03 12:16:47 +01:00
|
|
|
paplay $SOUND &
|
2020-12-22 17:04:22 +01:00
|
|
|
;;
|
|
|
|
m*)
|
2021-01-04 18:27:42 +01:00
|
|
|
pactl set-sink-mute $SINK toggle
|
2021-02-03 12:16:47 +01:00
|
|
|
paplay $SOUND &
|
2020-12-22 17:04:22 +01:00
|
|
|
;;
|
2021-01-04 17:37:20 +01:00
|
|
|
gui)
|
2021-01-04 18:27:42 +01:00
|
|
|
_check_app $APP
|
|
|
|
_toggle $APP
|
2021-01-04 17:37:20 +01:00
|
|
|
;;
|
2020-12-22 17:04:22 +01:00
|
|
|
*)
|
2021-01-04 18:27:42 +01:00
|
|
|
echo "invalid command: \"$1\""
|
|
|
|
echo "arguments: [decrease|increase|mute|gui]"
|
2020-12-22 17:04:22 +01:00
|
|
|
;;
|
|
|
|
esac
|