Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

system wide keyboard hook on X under linux

Tags:

linux

What would be the best approach to install a keyboard hook on Linux (X-windows) in order to trigger some application when some key-combo is pressed?? Is there a way to do this regardless of which window manager is running? The idea is to have an application being called ( or brought to foreground ) when some key is pressed in a way similar that Google Desktop does to Ctrl-Ctrl.

like image 827
Dprado Avatar asked Sep 28 '08 00:09

Dprado


1 Answers

XGrabKey on the root window is how xbindkey does it. Be careful about having some alternative method of killing the grab though, it's very annoying to have to go somewhere to ssh into your own box just to kill that process... And that's why, if it was me, xbindkeys+"echo 'moo' > /tmp/moo-fifo" would be the way to do it. That way, you could also control it in any number of other ways you haven't thought of yet.

like image 174
Anders Eurenius Avatar answered Oct 24 '22 14:10

Anders Eurenius