views:

329

answers:

2

Developing a mac app, how can I tell whether the user is currently at their computer or not? Or how long ago they last pressed a key or moved the mouse?

A: 

You can use Quartz event taps and an NSTimer. Any time one of your event taps lights up, postpone the timer by setting its fire date. When the timer fires, the user is idle.

I'm not sure whether Quartz event taps are exposed to Python, though. The drawing APIs are, but I'm not sure about event taps.

Peter Hosey
+1  A: 

it turns out the answer was here

http://osdir.com/ml/python.pyobjc.devel/2006-09/msg00013.html

zak23