diff --git a/cron-rest-eyes b/cron-rest-eyes index 9ed7671..2fa5bf8 100755 --- a/cron-rest-eyes +++ b/cron-rest-eyes @@ -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!'