473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Hi...

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?

Thanks

Feb 21 '06 #1
6 1526
>> 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).


Take a look at

http://sourceforge.net/projects/watch/

If you'd like to be added as a developer, let me know...

Skip
Feb 21 '06 #2
So, so close.... The problem with this implementation is that it
doesn't monitor usb keyboards under linux at all as far as I can
tell....since no keyboard entry will show up in /proc/interrupts with a
usb keyboard. I absolutely need the keyboard monitoring as well.

Otherwise, your project would be the perfect starting point for me!

Anyone else have an idea as to what I can use with Python to know when
the keyboard is being used even when I don't have focus?

Thanks
Sam

Feb 21 '06 #3
sa*******@gmail.com schrieb:
So, so close.... The problem with this implementation is that it
doesn't monitor usb keyboards under linux at all as far as I can
tell....since no keyboard entry will show up in /proc/interrupts with a
usb keyboard. I absolutely need the keyboard monitoring as well.

Otherwise, your project would be the perfect starting point for me!

Anyone else have an idea as to what I can use with Python to know when
the keyboard is being used even when I don't have focus?


If you can wait a few month, I'll be doing that in python based on this:

http://www.frogmouth.net/hid-doco/linux-hid.html

I'll be doing it for a art-project that is scheduled some months away. But I think the above information even should
help you get started on your own.

Diez
Feb 21 '06 #4
So, so close.... The problem with this implementation is that it
doesn't monitor usb keyboards under linux at all as far as I can
tell....since no keyboard entry will show up in /proc/interrupts with
a usb keyboard. I absolutely need the keyboard monitoring as well.


Sam's> Otherwise, your project would be the perfect starting point for me!

Hmmm... I'm confused. It is a starting point, just not one that monitors
USB keyboards. A "perfect" starting point would be one in which you didn't
need to make any changes. Why throw the baby out with the bath water? Why
not just rewrite check_linux_interrupts to somehow watch the usb keyboard as
well (however that might be done)? It's not going to be any more difficult
to check for USB keyboard interrupts in this project than in some other and
it already has a more-or-less functional user interface and support for
Windows.

Skip
Feb 21 '06 #5
Well, this is the one part that I have no idea how to do....as far as I
can tell the information simply is not in /proc. I need a different
method to discover when someone is typing. That's what I came to the
list for, to get a clue as to how to do that.

Certainly someone has an idea how to detect typing on a usb keyboard
under python....some external library must exist?

Thanks

p.s. Diez...I'll read that over, and will look forward to seeing what
you come up with. Please email me to let me know......I suspect that
your approach will require kernel modifications.... I don't want to go
down that path. I'd be okay with it once, cut the last thing I want to
do is repatch my ubuntu kernel every time there was a security fix.

Feb 21 '06 #6
sa*******@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

Feb 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

49
by: bearophileHUGS | last post by:
Adding Optional Static Typing to Python looks like a quite complex thing, but useful too: http://www.artima.com/weblogs/viewpost.jsp?thread=85551 I have just a couple of notes: Boo...
18
by: Mad Programmer | last post by:
I'm writing a destructive trojan with C++ and I need to know how I can destroy the target's monitor and format the target's harddisk before the target can stop the program. What do I need to do?
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
6
by: KK | last post by:
Dear All My requirement is to write class that is thread safe.( All public methods & static methods must be thread safe ). I found two options to implement this 1.using...
4
by: John | last post by:
I'd like to write a programme that runs on a PC with two monitors. The application would be used in a shop, with one monitor for shop assistant and the other for the customer. The two must show...
7
by: mojtaba_danai | last post by:
Hi Hope that some one can help with the following. I wish to write a Visual C++ program, which monitors 3-4 other services (process/programs also written in VC++). The program shall monitor, if...
2
by: Luc The Perverse | last post by:
I am a Java programmer - but I have had some experience programming in C++ before (3 years on a job) I have need of an application or set of applications to do the following on a windows...
9
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
22
by: JoeC | last post by:
I am working on another game project and it is comming along. It is an improvment over a previous version I wrote. I am trying to write better programs and often wonder how to get better at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.