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.
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"?).
精彩评论