sway_volume: add notifications via dunst
This commit is contained in:
parent
c3ec03e987
commit
e7bafaf63a
1 changed files with 25 additions and 0 deletions
|
@ -1,6 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source $HOME/.config/sway/bin/sway_helpers
|
source $HOME/.config/sway/bin/sway_helpers
|
||||||
SINK=$(pactl info | grep "Default Sink" | cut -d ' ' -f 3)
|
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"
|
APP="pavucontrol"
|
||||||
SOUND=$HOME/.config/sway/bin/drip.ogg
|
SOUND=$HOME/.config/sway/bin/drip.ogg
|
||||||
|
|
||||||
|
@ -24,14 +46,17 @@ case $1 in
|
||||||
d*)
|
d*)
|
||||||
pactl set-sink-volume $SINK -5%
|
pactl set-sink-volume $SINK -5%
|
||||||
paplay $SOUND &
|
paplay $SOUND &
|
||||||
|
notify
|
||||||
;;
|
;;
|
||||||
i*)
|
i*)
|
||||||
pactl set-sink-volume $SINK +5%
|
pactl set-sink-volume $SINK +5%
|
||||||
paplay $SOUND &
|
paplay $SOUND &
|
||||||
|
notify
|
||||||
;;
|
;;
|
||||||
m*)
|
m*)
|
||||||
pactl set-sink-mute $SINK toggle
|
pactl set-sink-mute $SINK toggle
|
||||||
paplay $SOUND &
|
paplay $SOUND &
|
||||||
|
notify
|
||||||
;;
|
;;
|
||||||
gui)
|
gui)
|
||||||
_check_app $APP
|
_check_app $APP
|
||||||
|
|
Loading…
Reference in a new issue