System idle time under Linux

Seebs usenet-nospam at seebs.net
Wed Sep 29 15:07:55 EDT 2010


On 2010-09-29, Hugo L?veill? <hugol at fastmail.net> wrote:
> One I am looking for, is time since last user mouse or keyboard action.
> So I guess I am looking for the exact same thing a screensaver is
> looking for

You can probably get it from X somehow, but... Basically, be aware that
it is entirely possible for a Linux user to invoke python scripts in an
enviromnent where this information cannot be obtained, and may not even
meaningfully exist.

So be sure you fail back gracefully when that happens.  Decide in advance
what you will infer from "there is no way to obtain this information".  Also
provide an override.  Imagine how helpful it would be to a user to have your
script act as though the user had gone idle based on what some OTHER user
was doing!

-s



More information about the Python-list mailing list