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:

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.


This article can be found online at the Debian Administration website at the following bookmarkable URL:

This article is copyright 2008 Steve - please ask for permission to republish or translate.