diff --git a/bin/sway_volume b/bin/sway_volume index ccb59b3..d2455e3 100755 --- a/bin/sway_volume +++ b/bin/sway_volume @@ -1,6 +1,28 @@ #!/bin/bash source $HOME/.config/sway/bin/sway_helpers SINK=$(pactl info | grep "Default Sink" | cut -d ' ' -f 3) +ICON_PATH=$HOME/.local/share/icons/Tela-circle-dark/16/actions +NOTIFY_APP="dunstify -a \"Volume\" -r 97" + +function notify() { + VOLUME=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep -oE '[0-9]*%' | head -n 1 | sed 's/%//') + MUTE=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep 'Mute:' | cut -d " " -f 2) + + echo $MUTE + + ICON="" + if [ "$MUTE" = "yes" ]; then + ICON=$ICON_PATH/audio-volume-muted.svg + elif [ $VOLUME -le 33 ]; then + ICON=$ICON_PATH/audio-volume-low.svg + elif [ $VOLUME -le 67 ]; then + ICON=$ICON_PATH/audio-volume-medium.svg + else + ICON=$ICON_PATH/audio-volume-high.svg + fi + $NOTIFY_APP -i $ICON -a "Volume" "$VOLUME Mute: $MUTE" +} + APP="pavucontrol" SOUND=$HOME/.config/sway/bin/drip.ogg @@ -24,14 +46,17 @@ case $1 in d*) pactl set-sink-volume $SINK -5% paplay $SOUND & + notify ;; i*) pactl set-sink-volume $SINK +5% paplay $SOUND & + notify ;; m*) pactl set-sink-mute $SINK toggle paplay $SOUND & + notify ;; gui) _check_app $APP