config_sway/bin/sway_volume

45 lines
737 B
Text
Raw Normal View History

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