Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-27-2001, 11:59 PM   #1
LQ Newbie
Registered: Jun 2001
Posts: 11

Rep: Reputation: 0
Question Keyboard hook

Is it possible implement a systemwide keyboard hook under Linux? (Suppose I want to invoke a function in my application upon pressing the key F1 (EVEN IF MY APPLICATION HAS LOST FOCUS)). Is this possible under Linux?. Please help

Old 07-07-2001, 09:31 PM   #2
LQ Newbie
Registered: Jul 2001
Posts: 1

Rep: Reputation: 0
I'll assume that you're referring to programs running in XWindows.

Here's a possible solution using WindowMaker:

Edit the WindowMaker file (either by hand, or with wmakerconf or WPrefs) to add a new command to the root menu (that appears when you right click on the background). Here you can associate a file to execute (or do whatever with) with a keyboard shortcut. I just wrote a script that toggles my keyboard from the german layout to the US and vice versa and associated it with a key combination using this method. it works well, is executed in the background, and is independently of the focus.

I know that Sawmill also allows one to bind shortcuts if you're running gnome; however, I'm not sure if you can change more than just the window commands.

I hope this helps some. I suspect some of the other window managers may support something similar, although I haven't played around with them as much. Good luck!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dvd need to hook up msg4real Linux - Hardware 4 02-05-2005 07:17 PM
How to hook a stereo up to a computer? randyriver10 General 11 09-15-2004 06:14 PM
Hook a laptop to a car? prophet621 General 5 09-06-2004 10:12 PM
message hook in linux ? xunilpassion Programming 3 11-06-2003 02:22 PM
How do I hook a scanner up to a labtop? Becky General 7 11-05-2003 07:03 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration