By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,271 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,271 IT Pros & Developers. It's quick & easy.

Listening for keypress in the background

P: n/a
I have created a small Python program that is running on my desktop.

How can I make it listen for a certain keypress (say, Windows-key +
space) in a controlled fashion even when it is not the program having
focus?

I need to do this running under GNOME in Mandrake GN/Linux 10.

/Mathias
Oct 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Mathias Dahl wrote:
I have created a small Python program that is running on my desktop.

How can I make it listen for a certain keypress (say, Windows-key +
space) in a controlled fashion even when it is not the program having
focus?

I need to do this running under GNOME in Mandrake GN/Linux 10.


Search Google for "python keylogger".

-Peter
Oct 22 '05 #2

P: n/a
Peter Hansen <pe***@engcorp.com> writes:
How can I make it listen for a certain keypress (say, Windows-key +
space) in a controlled fashion even when it is not the program having
focus?

I need to do this running under GNOME in Mandrake GN/Linux 10.


Search Google for "python keylogger".


Thanks, good idea! The relevant pages I found only link to
Windows-specific keyloggers though.

I just got another idea on a solution for my main problem (invoking my
sleeping app) and that would be to let my window manager execute a
small "invoker" program that would communicate with the sleeping
app. The question is, which is the easiest way to communicate with a
running Python program? Signals? TCP/IP (not really, right?) Pipes?

Oct 22 '05 #3

P: n/a
Mathias Dahl <br********@gmail.com> writes:
Peter Hansen <pe***@engcorp.com> writes:
How can I make it listen for a certain keypress (say, Windows-key +
space) in a controlled fashion even when it is not the program having
focus?

I need to do this running under GNOME in Mandrake GN/Linux 10.


Search Google for "python keylogger".


Thanks, good idea! The relevant pages I found only link to
Windows-specific keyloggers though.

I just got another idea on a solution for my main problem (invoking my
sleeping app) and that would be to let my window manager execute a
small "invoker" program that would communicate with the sleeping
app. The question is, which is the easiest way to communicate with a
running Python program? Signals? TCP/IP (not really, right?) Pipes?


I solved it using named pipes (mkfifo, open and read) plus a simple
echo x > pipe to invoke.

Oct 23 '05 #4

P: n/a
Mathias Dahl wrote:
Peter Hansen <pe***@engcorp.com> writes:
How can I make it listen for a certain keypress (say, Windows-key +
space) in a controlled fashion even when it is not the program having
focus?

I need to do this running under GNOME in Mandrake GN/Linux 10.


Search Google for "python keylogger".


Thanks, good idea! The relevant pages I found only link to
Windows-specific keyloggers though.


Oops, you're quite right. Sorry! I didn't even read the second
sentence in your post. Stupid me...

-Peter
Oct 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.