How to detect user activity - for a screensaver for example.

Robert Kern kern at taliesen.caltech.edu
Sun Jul 20 06:16:21 EDT 2003


In article <bnnSa.43074$124.1021717 at wagner.videotron.net>,
	Hans Deragon <hans at deragon.biz> writes:
> Greetings.
> 
> 
>    If I want to write a screensaver for Linux using Python, how can I detect 
> that the user has not touched the keyboard or mouse for the last 5 mins?

Use the xscreensaver daemon to handle this for you. From the README:

"""It is trivially easy to add new display modes to xscreensaver: any program
which can be invoked in such a way that it draws on the root window of the
screen can be used as a screensaver.  You just change a config file --
there's no need to recompile or reinstall anything."""

http://www.jwz.org/xscreensaver/
Your Linux distribution should have it.

Now how you write to the root window is up to the graphics toolkit you are
using.

> Sincerely,
> Hans Deragon

-- 
Robert Kern
kern at caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list