From 721453c80f6adc2f1d06130d80a0c9d14c132528 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 10 Aug 2020 14:03:25 +0200 Subject: [PATCH] [FIX][SCRIPT] Notify Xautolock toggling errors --- scripts/toggle-xautolock | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/toggle-xautolock b/scripts/toggle-xautolock index 91c226d..875f324 100755 --- a/scripts/toggle-xautolock +++ b/scripts/toggle-xautolock @@ -10,7 +10,14 @@ case "$1" in ;; esac -xautolock "-$1" +notify() { + notify-send -u "${2:-low}" "$1" \ + -h string:x-canonical-private-synchronous:xautolock-toggle # Overwrite +} -notify-send -u low "Toggled Xautolock (${1}d)" \ - -h string:x-canonical-private-synchronous:xautolock-toggle # Override previous one +if ! xautolock "-$1"; then + notify "Could not toggle Xautolock" critical + exit 1 +fi + +notify "Toggled Xautolock (${1}d)"