Creating global keyboard shortcuts in GNOME

Posted by Steve on Mon 11 Aug 2008 at 11:09

The GNOME desktop environment is the default for Debian etch, and is one that I use every day. One thing that I always have a hard time remembering is how to setup global keyboard shortcuts, so this quick guide will document the process.

There is a simple applet (reached via the menu "Desktop | Preferences | Keyboard Shortcuts") which allows you to specify which keys should be used for common activities.

Using the applet you can, for example, setup the keybinding Ctrl-Alt-t to run a terminal. However the list of actions is static, and it isn't possible to add a new command there.

If you wish to bind Ctrl-Alt-e to launching emacs you're out of luck - to do this you must use the gconf-editor.

Launch the editor by opening a terminal and running:

skx@pies:~$ gconf-editor

Using the gconf-editor we will need to do two things:

  • Define a new command.
  • Define the shortcut which should be used to execute that command.

So first of all navigate to "apps | metacity | keybinding_commands". Once there in the righthand pane select "command_1" and change the value to /usr/bin/emacs.

Now we need to define the shortcut which will execute it, we do that by visiting the key "apps | metacity | global_keybindings". Choose "run_command_1" and set the value to be "<Control><Alt>e".

Now you should find that pressing Ctrl+Alt+e will launch emacs.

I hope in the future the keyboard shortcut application will allow you to define arbitrary commands and their associated shortcuts.

Share/Save/Bookmark


Posted by Anonymous (89.175.xx.xx) on Tue 12 Aug 2008 at 09:39
Thank you for this article. However, it is not Gnome-specific, it is metacity-specific.

If you opt to use compiz with Gnome, you may set whatever shortcuts you want in Compiz Settings Manager.

[ Parent | Reply to this comment ]

Posted by Steve (80.68.xx.xx) on Tue 12 Aug 2008 at 09:57
[ Send Message | View Steve's Scratchpad | View Weblogs ]

You're entirely correct.

I'm sorry for forgetting that.

Steve

[ Parent | Reply to this comment ]

Posted by Anonymous (87.96.xx.xx) on Tue 12 Aug 2008 at 19:29
Great article, thanks!

Also worth mentioning is the package xbindkeys, that works regardless of window manager, even when you run just a bare X. It can even map those odd "multimedia" keys.

Previously discussed here.

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search