From 9697b41a458c07f41d923b32d959e73a109dfee6 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 24 Oct 2021 15:00:22 +0300 Subject: scripts: use new dunst interface to pause --- .config/polybar/focus | 1 - .config/polybar/notification_pause.sh | 4 +--- .config/polybar/stop | 1 - .local/bin/toggle_notifications.sh | 16 ++++++---------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.config/polybar/focus b/.config/polybar/focus index 42edffb..49d46d2 100755 --- a/.config/polybar/focus +++ b/.config/polybar/focus @@ -44,4 +44,3 @@ if ($task =~ m/^(.*)?\s(\d+\w+)$/g) { print "$1 | $2"; } } -# print $task; diff --git a/.config/polybar/notification_pause.sh b/.config/polybar/notification_pause.sh index 1df1bd6..9bf6724 100755 --- a/.config/polybar/notification_pause.sh +++ b/.config/polybar/notification_pause.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash -TOGGLE=$HOME/.local/share/.pause_notifications - -if [ ! -e $TOGGLE ]; then +if ! $(dunstctl is-paused); then echo else printf "" diff --git a/.config/polybar/stop b/.config/polybar/stop index 58f8741..1efd193 100755 --- a/.config/polybar/stop +++ b/.config/polybar/stop @@ -44,4 +44,3 @@ if ($task =~ m/^(\d+)(.*)$/g) { exec(qq(dunstify --appname="task" --icon="kt-pause" "stopping" "$1")); } } - diff --git a/.local/bin/toggle_notifications.sh b/.local/bin/toggle_notifications.sh index 9b700b5..6818728 100755 --- a/.local/bin/toggle_notifications.sh +++ b/.local/bin/toggle_notifications.sh @@ -1,14 +1,10 @@ #!/usr/bin/env bash -TOGGLE=$HOME/.local/share/.pause_notifications - -if [ ! -e $TOGGLE ]; then - touch $TOGGLE - dunstify --appname="notifications" --icon="chronometer-pause" "pausing" -u low - sleep 3 - killall -SIGUSR1 dunst # pause -else - rm $TOGGLE - killall -SIGUSR2 dunst # resume +if $(dunstctl is-paused); then dunstify --appname="notifications" --icon="chronometer-start" "here's what happened" -u low + dunstctl set-paused false +else + dunstify --appname="notifications" --icon="chronometer-pause" "pausing" -u low + sleep 2 + dunstctl set-paused true fi -- cgit v1.2.3-70-g09d2