开发者

How to intercept keyboard shortcuts in GNOME

开发者 https://www.devze.com 2023-01-14 17:49 出处:网络
I want to write an application which will intercept some keyboards sequences (l开发者_如何学运维ike those in Emacs – "C-c C-c") and run some function.

I want to write an application which will intercept some keyboards sequences (l开发者_如何学运维ike those in Emacs – "C-c C-c") and run some function.

How can I do this in GNOME?

On which level I should do that (kernel, X11, window manager)?


To run a commond on a certain key press you can configure that in metacity or compiz (depending which you're running).

For metacity run gconf-editor, go to /apps/metacity/keybinding_commands and under there you will see command_1 etc. In there you set the command to run, and then in /apps/metacity/global_keybindings you set the keybindings to match. The key for run_command_1 runs the command for command_1, and so on.

For compiz you want to run ccsm ("compiz config settings manager") and use the Commands plugin to configure it, in more or less the same way.

For performing an action in Gedit, as far as I know there is no way to do that, unless there is an existing keyboard shortcut for the command you are issuing. In that case you may be able to find an app that translates "C-c C-u" into the right shortcut for Gedit. But I've never done it.

0

精彩评论

暂无评论...
验证码 换一张
取 消