I would like to write a Java app that counts how long I have been using the keyboard or mouse w/o a break. Are there any built-in classes or 3rd party libraries that can detect global keyboard/mouse use?
-
1When I type on the keyboard, sometimes I take short pauses to either think about what I am about to type or scratch my nose :) What would you describe as a break? More than a minute unresponsive to keystrokes?Anthony Forloney– Anthony Forloney2010-01-27 15:21:19 +00:00Commented Jan 27, 2010 at 15:21
-
1In case you want to replicate the effect, and not the fun of writing it yourself, have you looked at WorkRave? (www.workrave.org)Alex Feinman– Alex Feinman2010-01-27 15:25:06 +00:00Commented Jan 27, 2010 at 15:25
-
@Anthony: of course the break interval should be configurable. @Alex: thanks! I might just use that instead if it works for me.Jason S– Jason S2010-01-27 16:24:04 +00:00Commented Jan 27, 2010 at 16:24
Add a comment
|
2 Answers
This can only be by using windows's hook function by JNI Someone already posted code here
EDIT: this on is better it also covers mouse events
Comments
The collection of files for rawinputsharp and the accompanying article might prove helpful. It's not Java-specific, but hopefully you can adapt it to suit.