First, the standard GNU/Linux caveat: this is not a distro or application-specific technique. Metacity ships with Ubuntu as part of Gnome, any distro with Gnome can use this technique to launch any application you want (I'm not even certain that Metacity requires Gnome, to be honest...).
If you read my earlier post, you know I recently upgraded my work laptop from XP to Ubuntu (although I am sticking to the 10.4 LTS on my work laptop; 10.10 is working fine on one of my personal machines). I am still planning a more inclusive update that details all the subtle changes I ended up making and a review of how the transition has been, but I thought this deserved its own post.
After installing Ubuntu, I knew I needed a launcher of some type. I love Quicksilver for OS X, and one of my two primary Windows complaints is the lack of a decent launcher (the other is no workspaces - the commercial and free options don't tend to play well with all applications). Even with all the conveniences of Gnome Do, I still found myself occasionally slipping to the Windows + E and Windows + R keyboard shortcuts from time to time. I initially tried to train myself to Windows + Space (my Gnome Do shortcut), followed by "n" (all I need to get Nautilus), followed by enter. I could not ignore that this was quite blatently TWICE the keystrokes that the event should require.
I knew Metacity had good options for keybindings, and I initially tried to use the GUI in System - Preferences - Keyboard Shortcuts. Note that this interface is excellent for actions that are already in the list, or actions that are limited in scope (confined to a particular application, for example). However, I ran into some questionable functionality when attempting a global keyboard shortcut binding in this interface. Instead, use the gconf-editor. Don't see that anywhere? That's right, sorry but this is one of those tutorials that involves the always-frightening "Terminal". But it's easy, just launch the Terminal (Applications - Accessories - Terminal, for the unfamiliar), type the text "gconf-editor" and press the Enter key.
Using the left side of the window, navigate to Apps - Metacity - keybinding_commands:
- Enter the value "nautilus" (no quotes) for command_1 (or whatever command you want...).
- While we are here, enter the value "gnome-terminal --geometry 110x32" for command_2.
Still in the gconf-editor, navigate to Apps - Metacity - global_keybindings:
- Enter "
E" for run_command_1 (or whatever keyboard shortcut you want. Mod4 is the Windows key on my Dell Latitude.).
- Enter "
T" for run_command_2
These worked for me immediately, but I have read cases where restarting your window manager is necessary for these to function properly. If you see strange behavior, I recommend a window manager restart. And there you have it, Windows + E to launch Nautilus in Ubuntu. That's two fewer keystrokes than Windows + Space, N, Enter. And don't get me started on how much nicer Nautilus is than Windows Explorer.