jump to navigation

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.

Comments»

1. Marius - January 30, 2006

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.

2. Nigel Tao - January 31, 2006

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… 😦

3. Marius - January 31, 2006

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

4. Treviño - February 2, 2006

You can use xbindkeys instead… Usefull also for “dead keysâ€? (like the ones of the notebooks)

5. Richard - February 13, 2006

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

6. airtonix - March 6, 2006

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?!!!!!

7. kvonb - May 14, 2006

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.

8. Casey Watson - May 30, 2006

nice fix kvonb.

For run_command_1 value, I used “T” for Alt + T key combination.

9. wqwert - June 22, 2006

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

10. wqwert - June 22, 2006

the carrots were lost in the above note. (control) t != (control)t was the point.

11. Dawnmist - June 22, 2006

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.

12. fred - August 18, 2006

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

13. Abubakar - November 23, 2006

I want Ubuntu off my Laptop

14. aldeby - December 14, 2007

I got rid of Windows Vista on my laptop and set up Ubuntu :>

Please, the link you refer to does not load any more!

15. Chris - February 10, 2008

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

16. Chris - February 12, 2008

I’m using xbindkeys and xbindkeys-config to do it!

17. hidesertmlb - February 22, 2008

Brilliant kvonb! Works like a charm. Thanks for sharing.

18. keymapping sous Gnome, le clavier musical at Benjamin Baudouin - March 19, 2008

[…] Source […]

19. GeBo - April 4, 2008

@Chris

Install the program keytouch, which is in the repository

20. Vaneet Dadra - June 24, 2008

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??

21. Adventure kigoda - August 31, 2008

how can I download microsoft office for all program so as I will use for my Laptop.

22. keymapping sous Gnome, le clavier musical at Benjamin Baudouin - September 2, 2008

[…] Source (No Ratings Yet)  Loading … « /usr/bin/find: Argument list too long html2xml² » […]

23. darklaurel - October 23, 2008

Thanks for sharing.. this really helps me on my small keyword from Acer one a bit small keys..

24. veeseekay - June 4, 2009

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!

25. porno sikiÅŸ - September 27, 2010

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.

26. sex sikiÅŸ - September 28, 2010

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

27. vitalpills - October 6, 2010

Hello you! has cheapest pills. Generic pill – is bioequivalent copies of certain drugs on the market for several years.

28. Guiwe78 - December 27, 2011

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

29. icon designs - October 4, 2012
30. icon download - October 5, 2012
31. icon library - October 8, 2012
32. icons package - October 9, 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: