Create custom desktop shortcuts in Ubuntu
Do you need your operating system to be as efficient as possible? Do you hate having to go back and forth between the mouse and the keyboard? Would you rather have a keyboard shortcut for everything?
If this is you then you are in luck. Linux desktops tend to be the most configurable of all the desktops. And among the many configuration options is the keyboard shortcut. With this you can create shortcuts to get creative with starting applications.
In this article I am going to show you how to set custom keyboard shortcuts in GNOME and then show how you can get creative with them. The GNOME release I am using is 2.26.1 and the Ubuntu release is 9.04.
Creating shortcuts in GNOME is quite simple. You will notice in the Preferences sub-menu of the System menu there is an entry for Keyboard Shortcuts. Click on that to open up the Keyboard Shortcuts manager (see Figure 1). As you can see there are a number of keyboard shortcuts already created for you. This is not only a good place to create new
shortcuts but to find out what shortcuts are already enabled on the system. You might even find some of the keyboard shortcuts you want to use are disabled by default. You can enable them and give them new shortcuts. For example, the Expo key (which displays all desktops side by side - see Figure 2) is listed with the Mod4+E shortcut. What is the Mod4 key? It's the Window's key which is usually referred to as the "Super" key. So I reassigned that shortcut to work properly.
Add a new shortcut
Now it's time to see just how shortcuts are created. As I mentioned earlier, creating shortcuts really is quite simple.
Once you have the Keyboard Shortcuts window open you will see the Add key at the bottom of the window. If you click on that a new, small window will open (see Figure 3). In this new window you only need to add two pieces of information:
Name: This is the name of the shortcut.
Command: This is the command you want to run when you hit the keyboard shortcut.
After you fill out this information click Apply and you will see the shortcut is listed as disabled (see Figure 4). The reason the shortcut is listed as disabled is because an actual shortcut has yet to be defined. Now we have to define the shortcut. To do this click on the Disabled section associated with your shortcut. In figure 4 I have created a shortcut to open up the Claws Mail email client. Now I want to assign the shortcut combination of the Alt Key + "c" to start the application. To do this I will click on the "Disabled" entry which will change and say "New shortcut...". When you see this change hit the keyboard combination you want to use and it will then be assigned. You know it worked if the shortcut is now listed in conjunction with new shortcut.
Don't think you just have to be limited to opening up standard applications with this feature. For example: I use the Nano editor a LOT. But to use the Nano editor I have to open up a console window and then enter the nano command to start up the editor. Instead I create a shortcut that will automatically open up the gnome-terminal with the Nano editor running. To do this I will create a shortcut with the following information:
Command: gnome-terminal -e nano
Assign this the Ctrl-N combination and when you hit that keyboard shortcut you will have the gnome-terminal console opened immediately to the Nano editor.
You can also, for example, open a browser window to a specific site. Say, for instance, you want to have one keyboard shortcut to open Firefox to ghacks.net and one shortcut to open Firefox to Slashdot. You can do this by adding shortcuts with the following information:
Name: Firefox Ghacks
Command: firefox https://www.ghacks.net
Name: Firefox Slashdot
Command: firefox http://www.slashdot.org
Creating keyboard shortcuts can make your desktop life so much easier. Have you used creative shortcuts to make your desktop life easier? If so, share them.Advertisement