We define "idle" based on how screen savers in Linux define it.

I found this tool called "xautolock".

I tested it like this:

/usr/X11R6/bin/xautolock -time 1 -locker "notify-send test"

I placed this in /etc/rc.d/rc.local, but for some reason it was not working and I couldn't debug it.

Someone said to place it in .bash_profile. I found this file and placed it in there, but now my GUI won't start.

Because this command is a forever command, it always listens once executed. It never stops listening in order to determine idleness, so this means it can not go into .bash_profile.

I do not know how to place it in to /etc/rc.d/rc.local, so where can it go if it can not go into these files?

Perhaps there is a way to modify it so it can go into /etc/rc.d/rc.local? Perhaps something like:

DISPLAY=:0.0 /usr/X11R6/bin/xautolock -time 1 -locker "notify-send test"

Would that work?

I'm on CentOS and GNOME.


You can't place it in rc.local because it will require a running X session and rc.local is usually executed before or during starting X. Also the DISPLAY variable would have to be set as you already figured out correctly.

If you want to place it in your .bash_profile then just put a & at the end to run it in the background.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.