3

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?

3
  • 1
    When 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? Commented Jan 27, 2010 at 15:21
  • 1
    In case you want to replicate the effect, and not the fun of writing it yourself, have you looked at WorkRave? (www.workrave.org) Commented 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. Commented Jan 27, 2010 at 16:24

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.