From 78b62eae6d37106b315206eb54c93dc67f80deec Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Wed, 29 Jun 2022 17:39:04 +0200 Subject: [PATCH] Updated notification script Added support for dunst --- scripts/dnd.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/dnd.sh b/scripts/dnd.sh index d143063..5037511 100755 --- a/scripts/dnd.sh +++ b/scripts/dnd.sh @@ -1,20 +1,22 @@ #!/usr/bin/env bash -# Script to toggle Do not disturb mode for mako +# Script to toggle Do not disturb mode for mako and dunst # Permanent memory saved_state=0 # Toggle -if [ "${saved_state}" -eq 0 ] ; then +if [[ ${saved_state} -eq 0 ]] ; then ~/.scripts/notify.sh 'Hiding notifications' - sleep 2 + sleep 5 makoctl set-mode do-not-disturb + dunstctl set-paused true else makoctl set-mode default + dunstctl set-paused false ~/.scripts/notify.sh 'Showing notifications' fi # Update status in file -new_state=$( bc "(${saved_state} + 1) % 2" ) -sed -i "s/saved_state=[0|1]/saved_state=${new_state}/" "${0}" +new_state=$(( (${saved_state} + 1) % 2 )) +sed -i "s/^saved_state=.*$/saved_state=${new_state}/" "${0}"