From a7df82bfac49bd27421c6454daa43e726ab697f0 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 29 Dec 2013 02:29:39 +0300 Subject: [PATCH] screensaver: give 1 sec to dunst to hide msg --- .xinitrc | 2 -- bin/screensaver | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.xinitrc b/.xinitrc index 2e1102e..1c231c3 100644 --- a/.xinitrc +++ b/.xinitrc @@ -27,8 +27,6 @@ export GNOME_KEYRING_CONTROL GNOME_KEYRING_PID GPG_AGENT_INFO SSH_AUTH_SOCK ( xautolock -locker '~/bin/screensaver start' -notify 5 -notifier '~/bin/screensaver notify 5' & dunst & - # this pidfile is later used for screensaver - echo $! >.cache/dunst.pid gtk-redshift & skype & psi-plus & diff --git a/bin/screensaver b/bin/screensaver index 63bf6e5..fd8cdb3 100755 --- a/bin/screensaver +++ b/bin/screensaver @@ -1,18 +1,16 @@ #!/usr/bin/env bash -DUNST_PID=$(<~/.cache/dunst.pid) - if [ "$1" = "notify" ]; then # notify-send help says timeout is in milliseconds # but it appears that it is really in seconds (is it a dunst bug?) - notify-send -t 3 "Activating screensaver in $2 seconds..." + notify-send -t $[$2-1] "Activating screensaver in $2 seconds..." else - kill -USR1 $DUNST_PID + killall -USR1 dunst notify_suspend slock & slock_pid=$! # for xautolock -unlocknow - trap "kill -USR2 $DUNST_PID; kill $slock_pid" SIGTERM + trap "killall -USR2 dunst; kill $slock_pid" SIGTERM wait $slock_pid - kill -USR2 $DUNST_PID + killall -USR2 dunst fi