By default, Ubuntu comes with a set of keyboard shortcut that you can use straightaway. However, some of these keyboard shortcuts might not be desirable, troublesome, or obstructive and disrupting your productivity. For example, if you have a keyboard with a media button, that button is automatically mapped to Rhythmbox. If your favorite media player is Banshee, or Exaile, you might want to change the keyboard shortcut to your favorite application.
There are several ways to manage your keyboard shortcut in Linux. You can do it via Xmodmap (and Xkeycaps), Gnome Keyboard Shortcut or Compiz. In this article, we will focus mainly on Gnome Keyboard Shortcut and Compiz.
Gnome Keyboard Shortcut
The Gnome keyboard shortcut is by far the easiest way to assign/remap a shortcut key in any Gnome-based distro. Go to System -> Preferences -> Keyboard Shortcuts.
From here, you can scroll down the list to find the particular keyboard shortcut you want to change, click on the existing shortcut (and see the entry change to “New Shortcut”), and press the new keyboard shortcut that you want to assign to. For example, the default shortcut to launch the Run Application dialog is “Alt + F2“. If I want to change it, I will click on the Alt + F2 entry, follow by the new key, say “Alt + F12“.
In addition, you can also create your own keyboard shortcut and assign it to run an application, a command or a script. Click the “Add” button. It will prompt you to enter the name and command.
After you have added the command, you will see a new entry with the shortcut field “Disabled”. Click on it.
Press the keyboard buttons that you want to assign to launch this command. That’s it.
You can also use the above method to overwrite a default shortcut key. For example, the default behavior of the “Delete” button in your keyboard is to move your file to the trash. You can, however, create a new shortcut and map the “Delete” button to shred the file beyond recovery. It will overwrite the default behavior.
Note: If you want to remove the overwrite, you can remove the shortcut entry and restart your current session (logout and login again). The default behavior will restore.
Compiz is slightly more complicated than Gnome Keyboard Shortcut, but it is more versatile and give you more option.
Before we start, make sure you have Compiz Config Setting Manager installed, either from Ubuntu Software Center or from the terminal:
Launch Compiz Config Settings Manager (System -> Preferences -> CompizConfig Settings Manager)
Click the “Commands” option.
Enter the command in the command field. It can be an application, a command or even a path to script.
Next, go to the Key Bindings tab. Click the “Disabled” button for the command line that you have entered just now.
Check the “Enabled” checkbox and click the “Grab key combination” button. Press the keyboard shortcut and add any modifier key (Ctrl, Shift or Alt) if necessary. Click OK.
That’s it. What other ways do you use to assign/remap keyboard shortcuts in your distro?
Image credit: Mike Traboe