Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use notify-send.sh to replace notifications. #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions common/pulseaudio-ctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
;;
Expand All @@ -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
;;
Expand All @@ -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}"
Expand Down