Writing my own typing monitor program for RSI sufferers...

Carl Friedrich Bolz cfbolz at gmx.de
Wed Feb 22 06:21:22 EST 2006


samslists at gmail.com wrote:
> I want to write a program that will let me know after thirty minutes of
> typing that I need to take a five minute typing break.  But when I stop
> typing it's smart enough to pause the 30 minute timer automatically.
> This is under the X-Window System (Linux).
> 
> The tricky part is obviously knowing when the mouse and keyboard are
> being used....especially when my application doesn't have the focus.
> 
> Obviously I can't do this with just the base python install.  Is there
> an add on library that I can use to monitor the keyboard and mouse?
> Which is it?  Maybe one of the graphical libraries, like wx, or qt, or
> gtk?  Which functions do I need?

You can do a bit of X hackery. Look for example at

http://www.softlab.ece.ntua.gr/~sivann/src/misc/xkey.c

which is a C program that prints keypresses (in any application). Should 
be fairly easy to turn into a Python extension module to monitor X activity.

Cheers,

Carl Friedrich Bolz




More information about the Python-list mailing list