Tuesday, July 7, 2009, at 12:30 PM

Rapidly start a common task in Gnome with system-wide hotkeys

Not all of us are heavy mouse users. Even though "Start menus" and quick launch icons are quite useful, it's not always efficient to have to leave the keyboard to reach the mouse just to launch an often-used application. The same way you probably use the Ctrl+S shortcut more liberally than the Save icon (or even worse, the File > Save option), a simple two- or three-key combination can save you precious milliseconds for those repetitive tasks.

In GNOME (the default desktop environment for Ubuntu), there's a way to create up to twelve global keyboard shortcuts. In fact, there are not only A way, but MANY ways. I'll show you some in this article.

How to edit global shortcuts
In the Gnome Configuration Editor
You can start the Configuration Editor from the Applications > System Tools menu (you may need to activate this item in the menu editor), or from a console (gconf-editor). If you never used this tool, you'll find it's quite similar to Window's regedit: you have a tree on the left, and values related to the item selected in the tree, on the right.

To edit a global shortcut, you'll have to change two values: the key combination, and the command. Both values are linked by the same command number (noted as (N) just below).
  • /apps/metacity/global_keybindings/run_command_(N): The key combination to trigger the command. You can refer to other values already present in the Configuration Editor page. For example: w. (Note: represents the "Windows" key)
  • /apps/metacity/keybinding_commands/command_(N): The command to launch when the key combination is triggered. For example: firefox.
Any change done here is instantaneous. If a shortcut does not seem to do what it's supposed to, enter something like gcalctool as the command_(N) value, to see if at least the key combination gets registered.

In the CompizConfig Settings Manager
If you are running Compiz, and have the CompizConfig Settings Manager (CCSM) installed (you should, really), there's an easier way to manage your global keybindings. First, make sure to install compizconfig-settings-manager, either from Synaptic or the command line:
sudo apt-get install compizconfig-settings-manager

Now, start the tool by going to System > Preferences > CompizConfig Settings Manager. In the General section, open the Commands item. There, you'll see a first page,"Commands", and a second page, "Key Bindings". Just like with the Gnome Configuration Editor, enter a value in two linked fields to activate a global shortcut. As simple as this!

In Ubuntu Tweak
Even simpler the the previous methods, this one also involves installing a new application: Ubuntu Tweak. From the repos, install ubuntu-tweak, using either Synaptic or the command line:
sudo apt-get install ubuntu-tweak

Once installed, launch Applications > System Tools > Ubuntu Tweak. In the Personnal > Shortcuts section, you'll find the most intuitive way to edit your global keybindings yet.

In a terminal, through a shell script
For the console-lovers out there (I'm one of you guys), I created a nice shell script to manipulate the GNOME's global keybindings. Like all my (future) scripts, it's available on the XMoby's Geek Repo (direct link). Install in your ~/bin folder, and enjoy!

My personal shortcuts are:
  • <Super>q to launch a terminal window (gnome-terminal)

  • <Super>w to launch my Web browser (firefox)

  • <Super>x to launch my file eXplorer (nautilus)

By the way, <Super> (or sometimes <mod4>) is the "Windows" key on most keyboards.

Did you set up your environment with global hotkeys? If so, what launches what? If not, why? Please share your own tippidy-tap launch tips in the comments section below.

0 comments:

Post a Comment