Assign Custom Shortcut Keys on Ubuntu Linux
Ubuntu includes a very limited shortcut key configuration utility which doesn’t allow you to assign hotkeys to your own applications or scripts. To get around this limitation, we can use the built-in gconf-editor utility to assign them ourselves.
First you’ll want to load up gconf-editor by typing it into the Alt+F2 Run dialog.

Once in the application, navigate to the following key. If you are familiar with regedit on Windows, this is very similar.
apps \ metacity \ keybinding_commands
You’ll notice a bunch of values on the right. These are the available commands that you can create for assigning to shortcut keys in the next step.
Double-click on command_1 and enter in the full path to your script or executable that you are trying to run. (Note that you can use the which command from the shell to find the path most of the time)
Now navigate to the key “global_keybindings”, which is directly above the one we were on.
Here you will want to select run_command_1. Enter in the shortcut key in plain text. For instance, for Alt+T, you’ll do <Alt>T. You could use <Ctrl>T or <Alt><Ctrl>T, or whatever you want to assign to the key.
You can also create custom commands in the keybinding_commands and assign them in the global_keybindings if you want. Just remember that the keybindings will start with run_(name of command).
Daily Email Updates
You can get our how-to articles in your inbox each day for free. Just enter your name and email below:
| Similar Articles | Featured Wiki Articles |
| Latest Software Reviews | Quick Linux Tips |
| Geek Arcade | Popular Forum Threads |


I have a question related to hotkeys. I can switch between the desktop
and the tray, using Tab – but from there I can only move
from one panel to another. Ins’t there a way to – for example – restore
a KDocked app solely using the keyboard, by moving to the notification
panel and somehow picking its icon and hitting Enter or something like
that (similar to what can be done with the Windows tray)?
Thanks! This article was AMAZINGLY helpful btw!! Thanks!!!
invid,
I’m working on some articles to cover that type of scenario. The short answer is: It’s not built-in.
If you want a more configurable GUI experience, you should try Kubuntu or install KDE on top of Ubuntu, and try that out.
http://www.howtogeek.com/howto.....on-ubuntu/
I just tried doing what you describe, but can’t get it to work at all.
Could it be that it only works if you’re not using “Desktop Effects” (ie. compiz)?
Or do it the Unix way:
Reading values:
gconftool-2 -g /apps/metacity/keybinding_commands/command_1
Recursive list below a certain key:
gconftool -R /apps/metacity/keybinding_commands
gconftool -R /apps/metacity/global_keybindings
Writing values:
gconftool-2 -s /apps/metacity/keybinding_commands/command_1 -t string rxvt-unicode
gconftool-2 -s /apps/metacity/global_keybindings/run_command_1 -t string ‘F1′
Thanks! I have always liked the smaller taskbar in gnome as opposed to the default KDE one – but I haven’t really used KDE enough to uncover all of its customizing power. I’ll give KDE on Ubuntu a try – perhaps my next build will be Kubuntu!
Great tip, thanks.
Now how about switching between apps with a keystroke? I have a term with all my good stuff in it and if I’m two workspaces across it’s a pain to navigate back and find the term.
This tip launches a new app each time you do the keystroke. I just want to switch. Like with Quicksilver on the Mac.
Thank you!
I know, I want a hotkey specifically assigned to a particular window. What you can try is the drop-down console called Tilda:
http://www.howtogeek.com/howto.....in-ubuntu/
You can assign that console to a hotkey, and there are options to make it show up on all desktops. It’s what I use when on Ubuntu.
Noob to Ubuntu trying to figure out how to have hotkey “type” email address and other repetitive text?
I am LOVIN KDE now that I am actually running it and digging into it. But I still haven’t figured out how to navigate through the items in my taskbar items via the keyboard. Anyone know of a reference or guide that would shed some light on this?
Thanks!!
Hey, I am trying to get xmms working with global hotkeys, so this is what I tried:
keybinding_commands: command_1, value: xmms –play
global_keybindings: run_command_1. value: Up
Any idea why it doesn’t work?
Edit:
keybinding_commands: command_1, value: xmms –play
global_keybindings: run_command_1. value: Control Up (with the triangular characters around Control)
Thanks very much for sharing, this makes opening common applications so much easier.
Er, sorry if this sounds like a dumb question, but how do I enter a command that would open up a particular webpage (say, wikipedia) in Firefox (my default browser) withing gnome? I know in KDE it would be as easy as typing the web address (I think).
Thanks again tho!!
I’ve got a laptop, wich has four keys right top of keyboad (wifi on/off, webcam on/off, open mail and laptop on/off) three keys work as advertised by the icon, but the webcam key doesn’t, it switches me to tty2 (bummer) So my webcam can’t work, because it’s getting no power.
My question is: How do i change this key to it’s advertised function?
Is it possible in Feisty to assign a particular key combo to perform an action on an explicit window? For example, I would like to bind, say, F4 to raise the Thunderbird window (*not* re-execute thunderbird which is already running)?
When I am done reading my mail, I minimize the thunderbird window. But getting it re-raised again to read new is a hassle – one problem, is that the alt-tab window list has the minimized windows *at the bottom* – which is exactly what I don’t want!
Thanks.
I assigned a short cut key to start up tomcat in a xterm window. I would like to have a custom icon to this xterm window. Does anyone know how i can do that. I tried looking up the man page for xterm, didnt get any clue.
appreciate any help on this.
Guys, anybody happen to know how to view every process done by Ubuntu ? Eg: After starting Rhythmbox, what terminal command can be use to play or stop a song ? I think it would become useful with scripting.
Thanks
Hi All,
I am facing some issues iwth my fedora core 5 desktop. I cahnged the resolution of my desktop with root previlges. It happenedeto all the users and root’s desktop, but it is not happening for a particular user’s desktop. I used the command system-config-display for this. Is there any way to change it using the gconf-editor. How can I set up my browser to connect to internet only through proxy server allways(mandatory for all the users-they will not be able to change it).
Thanks,
Joshi
@JDS: Check out Snippits: http://ben.kudria.net/code/snippits
@How-To Geek: How can I map special keys such as the “windows” key or the “pause/break” key using this method?
Found it!
Super_L = Left Win key
Super_R = Right Win key
It says:
“There was an error running the command “/home/myname/file.py”:
Starting the child process “/home/myname/file.py” failed (Permission denied).”
(Translated it from Finnish)
It says it for every file in my home directory. Even for .txt files! If i write “firefox” to the command_1 it opens it easily.
What is wrong? And btw I have Ubuntu 8.04.
@ John David : what about pause n break keys?? did you find it
Firstly thanks for the article..
I have the same problem with Miikka and Ubuntu 8.04
Is there a solution.
I figure out that one of the problem is numpad cannot be used with this. Is there a way that I can appoint a function to numpad ‘8′?
Thank you for this it was just what I was looking for. I have mentioned this thread here (http://www.aspireoneuser.com/f.....mp;t=9002), I hope that is ok.
Thanks again
Sy
Ugur:
You can access the keypad numbers with something like “<Super>KP_5″
Question for the masses:
I can get this to work with any of the keypad except number 9. When I set a command to 9, it gets recorded as such in the Configuration Editor, however the previous value remains active, and 9 doesn’t work. Eg. If I change “KP_5″ to “KP_9″ (in conjuction with <Control> and <Super>then pressing 5 works, and 9 does not. Is this how it works for other people?
And I can’t get any punctuation keys, or symbols around the numpad to work. Does anyone know of a comprehensive list of the names of the keys? Google has been failing me.
Thanks for replies.
I have another question:
Is it possible to appoint key combinations other than alt and control, like a+s or KP_8+KP_9
This article was really helpful. But I think one needs to write the Control key at instead of . At least for me, on Ubuntu 8.10, the latter didn’t work.
This was a useful article for me last year (Thanks alot, I needed it), but the development team has taken notice with Ubuntu 9.04. The steps given are no longer valid, and they added the ability to easily create custom commands using the Keyboard configurator that was nearly worthless beforehand.