Listening for keypress in the background

M

Mathias Dahl

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
 
P

Peter Hansen

Mathias said:
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
 
M

Mathias Dahl

Peter Hansen said:
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?
 
M

Mathias Dahl

Mathias Dahl said:
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.
 
P

Peter Hansen

Mathias said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top