Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to monitor if a X session is inactive for i.e 10 minutes? And I would execute a command when it happens, like a screensaver, but it's not a screensaver in this case.

share|improve this question

For gnome-screensaver, check out this page. He has a python script which hooks up to the screensaver events to run commands.

Also xscreensaver has an option you can use in a script to react to screensaver events (look for -watch option)

Set the screensaver to do nothing on activation if you don't actually want the screensaver to kick in, and you're done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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