screensaver: give 1 sec to dunst to hide msg

This commit is contained in:
2013-12-29 02:29:39 +03:00
parent ee071c31c7
commit a7df82bfac
2 changed files with 4 additions and 8 deletions

View File

@@ -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 &

View File

@@ -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