Defining Keyboard Shortcuts for Commands January 30, 2006
Posted by Carthik in administration, guides, snippets, ubuntu.trackback
One of the insanely difficult things to do in Gnome/Ubuntu is to map a custom keyboard shortcut to launch an application. Someone out there knows why one has to muck about in the gconf-editor to do this!!! Usability experts, listen up and fix this! While you are at it, please make it easier to change the default application used to open different filetypes.
But I rant, needlessly 🙂
Faced with the difficult problem of creating a keyboard shortcut to have +E to open up Nautilus, I found this very useful guide to adding keyboard shortcuts for commands in Gnome.
Most of those bindings could be done directly from Preferences / Keyboard Shortcuts, unfortunately many shortcuts will just not work for some actions (but will work for other actions). For example, a shortcut that works fine for bringing up Nautilus will not bring up a terminal window. Beats me why. The only solution in this case is to use something low level like xbindkeys.
Regarding a UI for custom keyboard shortcuts, some progress was hinted at on http://mail.gnome.org/archives/desktop-devel-list/2005-July/msg00007.html but this seems to have stalled.
Regarding Marius’ comment, the link above hints at the mess under the one UI hood (with three different modules handling keyboard shortcuts), and one of those doesn’t handle the Super key (aka Windows aka Mod4).
See, for example
http://bugzilla.gnome.org/show_bug.cgi?id=165343
http://bugzilla.gnome.org/show_bug.cgi?id=167662
http://bugzilla.gnome.org/show_bug.cgi?id=318704
Yeah, they’re known bugs, that nobody’s really working on at the moment… 😦
Well, you can use the Win key, but only some combinations will work.
You have to set the proper behavior for the Win key, here is an older posting of mine on the subject:
http://marius.scurtescu.com/?p=62
You can use xbindkeys instead… Usefull also for “dead keysâ€? (like the ones of the notebooks)
hey there, this particular tool does not allow for adding new shortcuts, but at least allows you to set shortcuts for a subset of known commands – go to System -> Preferences -> Keyboard Shortcuts.
The important ones are in there, home folder and terminal
ahhh marius, it’s the reverse for me using the System -> Preferences -> Keyboard Shortcuts.
I can assign A as the combo that opens a terminal window, but there is no way i can get the home folder window to open up with whatever key combo i want.
isn’t this odd?!!!!!
1) Run gconf-editor
2) Find Apps -> Metacity -> Keybinding Commands
3) Click on command_1 -or any empty one upto- command_12
4) In “value” type the command you want to run
5) Move upto “global_keybindings”
6) Click on “run_command_x (x corresponds to the value at 3)
7) Type in a key or combination, eg:
Super_L = Left Win key
Super_R = Right Win key
8) It should work straight away
To find a value of a key, run: gnome-keybinding-properties and click in an unused box then press the key you want. Just press backspace to clear it before you quit if you don’t want to save it.
nice fix kvonb.
For run_command_1 value, I used “T” for Alt + T key combination.
A note about metacity: make sure there is no space between the key and the letter for the value in global_keybindings. For instance t is not the same as t
the carrots were lost in the above note. (control) t != (control)t was the point.
You said: “While you are at it, please make it easier to change the default application used to open different filetypes.”
Changing the default program to open specific mimetypes from nautilus is actually fairly simple, when you know where to look 🙂
1. In nautilus, right-click on a file of the type you wish to set the default program for, and choose “Properties” from the bottom of the pop-up menu.
2. The 4th Tab should be “Open With”. Choose this tab.
3. There should be a list of programs that nautilus/gnome-open already knows is capable of openning the file.
3.a) If the one you want is listed, select the radio-button for it.
3.b) If it is not listed, create a new entry by choosing the “Add” button, and typing the command name in the popup box that appears. This will add it to the list, and automatically select the new program as the preferred application to use.
4. Choose close – nautilus and anything that uses gnome-open will now use the selected program to open files of this type :).
The best thing is that it’s usually because a file openned in the wrong program that you want to reset this, so you’ve probably already got nautilus pointing to that file and the right-click menu is *right there* where you need it.
For a once-off (e.g. I usually want to open an html page in a browser, unless I’m editing it), using the right-click menu will give you the list of program choices from above in an “Open With” menu, so you can also use this method to simply extend the list offered even when you don’t want to use a program all the time.
when i lock the screen while my keyboard layout in (fr) i cant get back. since my pass is in english.
is there any key combination to switch language.?
ubuntu 6.06 dapper
thanks
I want Ubuntu off my Laptop
I got rid of Windows Vista on my laptop and set up Ubuntu :>
Please, the link you refer to does not load any more!
Hey guys, I can bind key combos like kvonb said, but can’t add a command to a special key of my keyboard.
My logitech keyboard has extra keys, which I can assign in gnome-keybinding-properties.
For example I want key 0xaf to put the system into sleep. But there is no “sleep” in keybinding properties. If I put “0xaf” instead of a keyboard combo in metacity, it’s not recognized!
Is there any way?
Thanks
I’m using xbindkeys and xbindkeys-config to do it!
Brilliant kvonb! Works like a charm. Thanks for sharing.
[…] Source […]
@Chris
Install the program keytouch, which is in the repository
Hey Kvonb,
I am not able to get the key combination…
I tried to get it as you said and it said Shift+Ctrl+:
but when I pasted it in the “run_command_1″ it does not work…..
I tried gnome-terminal command to use from keyboard shortcut.
Can you help me??
how can I download microsoft office for all program so as I will use for my Laptop.
[…] Source (No Ratings Yet) Loading … « /usr/bin/find: Argument list too long html2xml² » […]
Thanks for sharing.. this really helps me on my small keyword from Acer one a bit small keys..
Real good info here, My shortcut keys configured through the keyboard shortcuts option under System>>Preferences did not seem to work.
I had the Super_R key set to screen lock, but it suddenly stopped working and I stumbled upon this info which helped me configure the shortcut again.
Thank you very much!
To find a value of a key, run: gnome-keybinding-properties and click in an unused box then press the key you want. Just press backspace to clear it before you quit if you don’t want to save it.
A note about metacity: make sure there is no space between the key and the letter for the value in global_keybindings. For instance t is not the same as t
Hello you! has cheapest pills. Generic pill – is bioequivalent copies of certain drugs on the market for several years.
If you have changed something with gnome-keybinding-properties (for example disabled a keyboard shortcut, e.g. ALT+F1 -that shows the main menu of the panel-) but the changes don’t work (and F5 or CTRL+R on the desktop don’t solve it) this command can solve the problem:
metacity –replace (you can run it from the dialog that appears holding the ALT key and pressing the F2 key)
This (re)starts the Metacity window manager.
You can also start Metacity running (but not restart it; only works to start Metacity if another window manager is in use before):
gnome-appearance-properties (also possible from ALT+F2) and setting “Visual Effects” to None
Paraphrase please the message
I know a site with answers on interesting you a question.
Till what time?
So happens. Let’s discuss this question. Here or in PM.