tags:

views:

51

answers:

1

How can I determine idle time in Python on Linux, meaning no keyboard or mouse activity for the past few seconds or minutes? All present links tell how to do it on windows but not on Linux.

A: 

Usually the screen saver daemon handles idle time reporting in Linux. If you are running XScreenSaver, you can use PyXSS. gnome-screensaver and kscreensaver have a GetSessionIdleTime method that you can call using D-Bus, but I'm not sure it does what I think it does (i.e. when is the system considered "idle"?).

Johannes Sasongko