[PyKDE] idle time detection
jbublitz at nwinternet.com
Thu Nov 9 20:50:45 GMT 2006
On Thursday 09 November 2006 10:51, Sebastian Kügler wrote:
> Can anyone think of some clean way for a PyKDE application to detect idle
> For the Kubuntu powermanager applet, we're currently missing that feature.
> The usecase would be kicking in a suspend / hibernate / dimming display
> after N seconds of no mouse or keyboard activity.
> Thanks for your input,
I'd try subclassing KApplication and overloading the event loop stuff (not
quite sure where). Set a QTimer to fire and dim the display or whatever in N
seconds and then in the event loop, detect any mouse or keyboard events to
reset the QTimer if one is found. Typical watchdog timer application.
Seems like that should work, except for dialogs which run their own event
loops (you'd probably want to disable the timer during any dialog execution).
There's probably a way to do it with event handlers on objects which have the
focus too, if there aren't too many possibilities of those, or your app is
structured to allow for that.
More information about the PyQt