473,396 Members | 1,838 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,396 software developers and data experts.

Listening for keypress in the background

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
4 4530
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: brettk | last post by:
Hello All, I've written a small daemon that monitors a pop3 mailbox and downloads any new messages. It's run from the console in windows, and instead of having it print something each time it...
1
by: Mathias Dahl | last post by:
I am creating a small app called PyQe (http://klibb.com/cgi-bin/wiki.pl/PyQe) to launch commands and programs quickly. I works more or less as I want it now and I have managed to make my window...
0
by: Mathias Dahl | last post by:
I have created a 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...
3
by: Joshua Campbell | last post by:
I am wanting to write a program that will run in the background, but will intercept a keypress (<CTRL> + <ALT> + L) and do a certain action. Unfortunately, the only way that I've been able to...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
3
by: Robert W. | last post by:
In my WinForms app I wanted to implement a Read-Only textbox. I didn't like the appearance a textbox takes on when the ReadOnly property is set true so instead I trapped the KeyPress event with a...
4
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
I know how to capture a keypress for a windows application, but how would I go about doing it for a windows service? Rather than having a form in focus all the time, I would prefer to have...
2
by: newbiegalore | last post by:
Hello everyone I have just finished going through some tutorials on developing extensions for mozilla and have made a version of the born-geek toolbar. Being a newbie I am stuck at a relatively...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.