简体   繁体   English

Linux下X上的系统范围键盘挂钩

[英]system wide keyboard hook on X under 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?? 在Linux(X-windows)上安装键盘挂钩以触发某些应用程序的最佳方法是什么? 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. 这样做的想法是,当按某些键(类似于Google桌面与Ctrl-Ctrl的方式)时,将调用一个应用程序(或将其置于前台)。

XGrabKey on the root window is how xbindkey does it. 根窗口上的XGrabKey是xbindkey的工作方式。 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. 但是,请谨慎使用其他方法来杀死抢夺,这很烦人,必须去某个地方将其ssh入自己的盒子中才能杀死该进程。这就是为什么如果是我, xbindkeys +“ echo'moo '> / tmp / moo-fifo“就是这样做的方法。 That way, you could also control it in any number of other ways you haven't thought of yet. 这样,您还可以用其他您尚未想到的其他方式来控制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM