I remember well how a friend of mine proudly showed me that he could easily launch Internet Explorer using a special key at the top of his keyboard. Today, I know that with Xubuntu, I can use my regular keys (and cheap keyboard 😉 ) to launch any program. Inspired by this article I decided to share this trick with you.
How it works? Simple. As you might know, a program on Linux is started when a command is executed. A command is executed e.g. when you type it in the terminal, but also when you click a menu entry in your applications menu. In Xubuntu, you can assign these commands to certain keyboard shortcuts, so that when you press the set key combination, the specified command will be executed.
Of course, in order to assign a command to a keyboard shortcut, you need to know which command you need. In order to find this, you can use Xfce’s Appfinder, which you can find in the Applications menu under Accessories.
Using the “Search:” box on top, you can find the program you need the command of. I wanted to find “Warzone 2100”, so I entered that and pressed “Enter”. It then showed up in the list. To find the command, I right-clicked Warzone 2100’s entry and selected “More Information…”:
As you can see, Warzone 2100’s command is, surprisingly,
I then fired up my keyboard settings from Applications->Settings->Keyboard Settings. On top, I selected the “Shortcuts” tab. The first time you want to add keyboard shortcuts, you need to create a new “Theme” using the left Add button. As you can see, I created the theme “Examples”, and had created the theme “Vincent” before.
Then using the right “Add” button you can assign a new command so a certain keyboard shortcut. I could’ve used Warzone 2100 here, but I used xflock4 because this command is not one you’d find with the Appfinder and I personally use it a lot. As you might guess, this command locks the screen (i.e. starts your screensaver).
After I clicked OK I was prompted for the command I wanted to use.
As I like to use my left “Ctrl” key in combination with the “0” in the numpad on the right, I entered that. And that was it! I could now use that key combination to lock my screen!
Admittedly, the “Keyboard Settings” window is not very user-friendly, and yes, the creation of themes sounds a bit useless to me to, but at least it works. You can use the same procedure to add a keyboard shortcut for all your favourite programs. For example, I used this to assign Ctrl+F12 to the command “firefox” which will, not surprisingly, open Firefox. So by combining with the Ctrl key, I already have 12 possible special keys on top of my keyboard!
In my next post I’ll show how to control your media player to skip to the next song when you press a combination of keys. Stay tuned!