Linux下X上的系统范围键盘钩 [英] system wide keyboard hook on X under linux

查看:79
本文介绍了Linux下X上的系统范围键盘钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux(X-windows)上安装键盘挂钩以在按下某些组合键时触发某些应用程序的最佳方法是什么?不管运行哪个窗口管理器,有没有办法做到这一点?这样做的想法是,当按某些键(类似于Google桌面与Ctrl-Ctrl的方式)时,会调用一个应用程序(或将其置于前台).

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.

推荐答案

XGrabKey的.不过,请谨慎使用一些其他方法来杀死抢夺,这很烦人,必须到某个地方将ssh放入自己的盒子中才能杀死该进程...这就是为什么如果是我的话,xbindkeys + "echo'moo'>/tmp/moo-fifo"将是实现此目的的方法.这样,您还可以用其他您尚未想到的其他方式来控制它.

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.

这篇关于Linux下X上的系统范围键盘钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆