cron-rest-eyes: do not run while gnome-screensaver is active

This commit is contained in:
Josh Holtrop 2011-05-26 10:33:06 -04:00
parent ad019bf846
commit 2971e5b45b

View File

@ -1,10 +1,17 @@
#!/bin/sh
# no message if one is displayed already
if [[ "`ps -efww | grep -v grep | grep gxmessage`" == "" ]]; then
# no message if screensaver active
if [ "`ps -efww | grep -v grep | grep xscreensaver`" == "" ]; then
export DISPLAY=:0
gxmessage 'Rest your eyes!'
fi
if [[ "$(ps -efww | grep -v grep | grep gxmessage)" != "" ]]; then
exit
fi
# no message if xscreensaver active
if [ "$(ps -efww | grep -v grep | grep xscreensaver)" != "" ]; then
exit
fi
# no message if gnome-screensaver active
if [ "$(gnome-screensaver-command --query | grep is.active)" != "" ]; then
exit
fi
export DISPLAY=:0
gxmessage 'Rest your eyes!'