Is there a neat/easy way in objective-c/cocoa to track if a user is at their computer, ie I assume by detecting key presses and mouse movement?
(ie I want to fill out my timesheet automatically by detecting when I am at work and not at work)
Is there a neat/easy way in objective-c/cocoa to track if a user is at their computer, ie I assume by detecting key presses and mouse movement?
(ie I want to fill out my timesheet automatically by detecting when I am at work and not at work)
You can detect mouse events across the entire log-in session using an event tap.
I'm pretty sure there's a way to do this for key events as well, but I don't remember what it was and it requires that the user have access for assistive devices turned on. Catching key events across the session is hard on purpose, in order to make Mac OS X unattractive for key-logger authors.
You should also use NSWorkspace's notifications to detect when the machine is about to go to sleep, and when it has just woken up from sleep.