tags:

views:

475

answers:

2

I want to track how long i been away from my keyboard/how long i took a break. I figure tracking my keyboard and mouse is a good way to see when i left and arrived. Whats the best way to track this? Some options i see

  • Have a system wide callback for every mouse and keyboard press.
  • Sleep for a 100ms and see if there is a keydown or mousemovent
  • Use a system call that actually tells me when the last userinput was and use a combo of the above for efficiently. (sleep until user is away, then use callback to track arrival)
+3  A: 

Try looking at this.

You shouldn't need to do the tracking yourself, it looks like you can do system calls to get the idle time.

Aaron Smith
I would include some code. Makes the answer nicer!
Keltex
acidzombie24