#!/bin/bash source $HOME/.config/sway/bin/sway_helpers SINK=$(pactl info | grep "Default Sink" | cut -d ' ' -f 3) APP="pavucontrol" 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