I\'m writing an command-line application which listens for Control key release events in X Windows and alerts another process when it detects them.
Being new to GNU/Linu
Thanks to the pykeylogger library mentioned by Croad Langshan, and to the helpful example code provided by Tim Alexander, the author of such library, I've been able to change my program to:
#!/usr/bin/env python
from pyxhook import HookManager
watched_keys = ["Control_R", "Control_L"]
def handle_event (event):
if event.Key in watched_keys:
print "KeyRelease"
hm = HookManager()
hm.HookKeyboard()
hm.KeyUp = handle_event
hm.start()
This program accomplishes my goal without any issue. You can read the fields of the "event" object for further information about the event (see source code of "pyxhook.py").