From 59306eb1315a9dc1932f1bdc6a941f5753453910 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 23 Feb 2021 15:28:31 -0400 Subject: [PATCH] Use notify-send.sh to replace notifications, so the screen does not get filled up with notifications. --- common/pulseaudio-ctl.in | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/common/pulseaudio-ctl.in b/common/pulseaudio-ctl.in index d73a4e5..32c2b8f 100644 --- a/common/pulseaudio-ctl.in +++ b/common/pulseaudio-ctl.in @@ -187,6 +187,8 @@ setup PERC=5 [[ -n "$2" ]] && [[ $(is_integer "${2%%%}") == '1' ]] && PERC=${2%%%} +NOTIF_FILE=/tmp/pulseaudio-ctl-notification + case "$1" in U|u|[U,u]p) # raise volume by $PERC % or set it to the upper threshold @@ -202,8 +204,8 @@ case "$1" in refreshbarvolperc if [[ $USEN -eq 1 ]]; then [[ $USEB -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 -i multimedia-volume-control --hint=int:transient:1 --hint=int:value:$UPPER_THRESHOLD_AWARE_VOL --hint=string:synchronous:volume "Volume up $PERC %" "" || - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume up $PERC%" "Current is $CURVOL %" --icon=multimedia-volume-control + notify-send.sh -a pulseaudio-ctl -t 1000 -i multimedia-volume-control --hint=int:transient:1 --hint=int:value:$UPPER_THRESHOLD_AWARE_VOL --hint=string:synchronous:volume "Volume up $PERC %" "" -R $NOTIF_FILE || + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume up $PERC%" "Current is $CURVOL %" --icon=multimedia-volume-control -R $NOTIF_FILE fi [[ $USEK -eq 1 ]] && kde_osd $CURVOL @@ -220,8 +222,8 @@ case "$1" in refreshbarvolperc if [[ $USEN -eq 1 ]]; then [[ $USEB -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 -i multimedia-volume-control --hint=int:transient:1 --hint=int:value:$UPPER_THRESHOLD_AWARE_VOL --hint=string:synchronous:volume "Volume down $PERC %" "" || - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume down $PERC%" "Current is $CURVOL %" --icon=multimedia-volume-control + notify-send.sh -a pulseaudio-ctl -t 1000 -i multimedia-volume-control --hint=int:transient:1 --hint=int:value:$UPPER_THRESHOLD_AWARE_VOL --hint=string:synchronous:volume "Volume down $PERC %" "" -R $NOTIF_FILE || + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume down $PERC%" "Current is $CURVOL %" --icon=multimedia-volume-control -R $NOTIF_FILE fi [[ $USEK -eq 1 ]] && kde_osd $CURVOL @@ -235,7 +237,7 @@ case "$1" in pactl set-sink-mute "$SINK" "$NEW_MUTE" MUTED=$(pacmd list-sinks|grep -A 15 '* index'|awk '/muted:/{ print $2 }') [[ $USEN -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Mute toggle" "Muted: $MUTED" --icon=audio-volume-muted + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Mute toggle" "Muted: $MUTED" --icon=audio-volume-muted -R $NOTIF_FILE if [[ $USEK -eq 1 ]]; then if [[ $MUTED == "yes" ]]; then kde_osd 0 @@ -254,7 +256,7 @@ case "$1" in pactl set-source-mute "$SOURCE" "$NEW_MUTE" SOURCE_MUTED=$(pacmd list-sources|grep -A 15 '* index'|awk '/muted:/{ print $2 }') [[ $USEN -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Mute toggle" "Muted: $SOURCE_MUTED" --icon=audio-volume-muted + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Mute toggle" "Muted: $SOURCE_MUTED" --icon=audio-volume-muted -R $NOTIF_FILE if [[ $USEK -eq 1 ]]; then if [[ $SOURCE_MUTED == "yes" ]]; then kde_osd_mic 0 @@ -274,7 +276,7 @@ case "$1" in esac refreshcurvol [[ $USEN -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume set" "Level: $CURVOL" --icon=multimedia-volume-control + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Volume set" "Level: $CURVOL" --icon=multimedia-volume-control -R $NOTIF_FILE [[ $USEK -eq 1 ]] && kde_osd $CURVOL ;; @@ -289,7 +291,7 @@ case "$1" in esac refreshcurvol [[ $USEN -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Atmost set" "Level: $CURVOL" --icon=multimedia-volume-control + notify-send.sh -a pulseaudio-ctl -t 1000 --hint=int:transient:1 "Atmost set" "Level: $CURVOL" --icon=multimedia-volume-control -R $NOTIF_FILE [[ $USEK -eq 1 ]] && kde_osd $CURVOL ;; @@ -305,7 +307,7 @@ case "$1" in *) # send to notify-send if enabled [[ $USEN -eq 1 ]] && - notify-send -a pulseaudio-ctl -t 8000 --hint=int:transient:1 "Pulseaudio Settings" "Volume level : $CURVOL %\nIs sink muted : $MUTED\nIs source muted : $SOURCE_MUTED\nDetected sink : $SINK\nDetected source : $SOURCE" --icon=multimedia-volume-control + notify-send.sh -a pulseaudio-ctl -t 8000 --hint=int:transient:1 "Pulseaudio Settings" "Volume level : $CURVOL %\nIs sink muted : $MUTED\nIs source muted : $SOURCE_MUTED\nDetected sink : $SINK\nDetected source : $SOURCE" --icon=multimedia-volume-control -R $NOTIF_FILE # add pretty colors for mute status for CLI only [[ "$MUTED" = "yes" ]] && MUTED="${NRM}${RED}$MUTED${NRM}" || MUTED="${NRM}${GRN}$MUTED${NRM}"