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.

 

 


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
[ 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 ]

Posted by Anonymous (78.53.xx.xx) on Mon 29 Jun 2009 at 22:08
Thanks you Steve, for this nice article. It seems to me, than you no longer need to use gconf-editor. I am using Gnome 2.22.2 on Ubuntu Jaunty Jackalope and the way "Desktop | Preferences | Keyboard Shortcuts" worked for me.

[ Parent | Reply to this comment ]

Posted by Anonymous (121.45.xx.xx) on Sat 5 Dec 2009 at 22:16
The Keyboard Shortcuts applet doesn't do what this does. It lets you assign a key to close a window or log out or whatever, but it doesn't do anything about assigning hotkeys to user-defined commands. That's yet another case where the Gnome designers have crippled their system because they feel certain that the users don't need to know. KDE is far superior in this regard.

[ Parent | Reply to this comment ]

Posted by Anonymous (72.230.xx.xx) on Fri 3 Sep 2010 at 01:48
You can press 'Add' in the Keyboard Shortcuts applet and define your own. Don't be an ass.

[ Parent | Reply to this comment ]

Posted by Anonymous (220.110.xx.xx) on Thu 19 May 2011 at 07:50
Good thanks.

[ Parent | Reply to this comment ]

Posted by Anonymous (192.100.xx.xx) on Wed 29 Jun 2011 at 09:24
Yes, I agree completely. Thank you for pointing that out. Another example (of "yet another case where the Gnome designers have crippled their system because they feel certain that the users don't need to know"): it seems to be impossible to operate the GUI mouseless. Even windows lets you do that.

The only problem with KDE is aesthetics: its kitchy, noisy look and feel.

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

What do you use for configuration management?








( 228 votes ~ 0 comments )