From 3b68e7fbf6162e1cf4388c1b54620cdc1ec0c2ab Mon Sep 17 00:00:00 2001 From: speedie Date: Sun, 26 Feb 2023 00:15:27 +0100 Subject: [PATCH] use dnote by default --- src/speedwm-audioctrl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/speedwm-audioctrl b/src/speedwm-audioctrl index 6b7d1d1..6afd46b 100755 --- a/src/speedwm-audioctrl +++ b/src/speedwm-audioctrl @@ -8,7 +8,7 @@ # Additionally requires pulsemixer for pulseaudio/pipewire or alsamixer for alsa if the mixer functionality is used [ -z "$STATUS" ] && STATUS="speedwm_status" -[ -z "$NOTIF_SYSTEM" ] && NOTIF_SYSTEM="notify-send" +[ -z "$NOTIF_SYSTEM" ] && NOTIF_SYSTEM="dnote" MUTE() { # Mute for pulseaudio/pipewire @@ -21,37 +21,47 @@ MUTE() { } RAISE() { + NOTIFY_VOL() { + [ "$NOTIF_SYSTEM" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4 + [ "$NOTIF_SYSTEM" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)" + } + PULSE() { command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ +${NUM}% - command -v notify-send > /dev/null && notify-send " $(pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }')" } ALSA() { command -v amixer > /dev/null && amixer -c 0 set Master ${NUM}%+ - command -v notify-send > /dev/null && notify-send " $(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%" } [ "$AUDIO" = "pulse" ] && PULSE || ALSA pidof "$STATUS" > /dev/null && \ kill -38 $(pidof $STATUS) + + NOTIFY_VOL } LOWER() { + NOTIFY_VOL() { + [ "$NOTIF_SYSTEM" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4 + [ "$NOTIF_SYSTEM" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)" + } + PULSE() { command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ -${NUM}% - command -v notify-send > /dev/null && notify-send " $(pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }')" } ALSA() { command -v amixer > /dev/null && amixer -c 0 set Master ${NUM}%- - command -v notify-send > /dev/null && notify-send " $(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%" } [ "$AUDIO" = "pulse" ] && PULSE || ALSA pidof "$STATUS" > /dev/null && \ kill -38 $(pidof $STATUS) + + NOTIFY_VOL } GETVOL() {