Master Your Keyboard with Linux

By Carla Schroder | Jul 16, 2007 | Print this Page
http://www.enterprisenetworkingplanet.com/netsysm/article.php/3689036/Master-Your-Keyboard-with-Linux.htm

Last week we skillfully disabled the horrid caps lock key forever with neither hammers nor pliers nor metal tools of any kind, and were introduced to XBindKeys for setting custom keybindings. Then we detoured a bit into how to use gksu and kdesu to launch graphical applications as root with the keyboard, which turned into a considerable, but important detour into the finer points of su and sudo. Now we return to more keyboard hacks using XBindKeys and KeyTouch. KeyTouch is an excellent program designed to put all those unsupported multi-media keys to useful work in Linux, instead of lying about uselessly.

Konqueror Profiles

Some applications come with various launch options. KDE's Konqueror is both a file manager and Web browser, and it supports creating custom profiles. To create a custom profile just fiddle and tweak until it looks the way you want, then run Settings -> Configure View Profiles and give it a profile name. For example, I have an enp profile that opens in my EnterpriseNetworkingPlanet folder all ready to go to work writing breathless deathless howtos just for you. This is bound to Alt + F9. In ~/.xbindkeysrc it looks like this:

#konqueror-enp
"/usr/bin/konqueror --profile enp"
    m:0x18 + c:75
    Alt+Mod2 + F9 

KDE should come with two default profiles: filemanagement and webbrowser. There may be more, depending on how much your particular Linux distribution has modified it.

OpenOffice Start Options

OpenOffice (sorry, I refuse to call it OpenOffice.org. It's a software suite, not a Web site) has these startup options in Kubuntu:

ooffice -writer
ooffice -impress
ooffice -base
ooffice -math
ooffice -web
ooffice -calc
ooffice -draw

In GNOME on Fedora it's openoffice.org-2.0 instead of ooffice, which sounds like getting oofed in the stomach.

Evolution Start Options

The Evolution suite has a number of startup options:

evolution --offline
evolution -c mail 
evolution -c contacts
evolution -c calendar 

Placeholders

When you go into your KDE or GNOME's menu editor and view the actual commands for launching your various applications, you'll often see placeholders, like firefox %u or konversation -caption "%c" %i %m. These are not vitally important, but this is what they mean so you can use them yourself with knowledge and flair:

%f - single file name
%F - list of files
%u - single URL
%U - list of URLs
%d - directory
%D - list of directories
%i - program icon
%m - mini icon
%c - caption

I haven't noticed that they make any difference. But maybe you'll find out differently.

How do you find out all this neat stuff for yourself? Haha, lots of luck! Maybe in your program documentation or man pages, maybe online in a Wiki or forum. Maybe running [application name] --help will reveal secrets. And of course check your menu editor, which must know these things.

KeyTouch

KeyTouch is designed especially for those gigantic multi-media keyboards with all the extra buttons above the F keys and everywhere else they think of to stick them. It's not for just any old keyboard; it has to be one of the fancy ones with all the special keys that usually are not supported in Linux. See keyboards.txt for a list. If your keyboard is not listed, visit Keyboards to learn how to import your keyboard into KeyTouch.

KeyTouch is a nice sleek application that is easy to use. First run keytouch-keyboard to select your keyboard. Then open KeyTouch either by typing the keytouch command, or with the menu icon. You'll see four tabs: Key Settings, Keyboard, Preferences, and Help & About. The Preferences tab is where your big-time customization happens. This has a feature that I wish more applications would copy- check out the three Choose buttons for selecting a Web browser, email program, and chat program.

Guess what happens when you click the Choose button? Come on, guess.

No, it does not present you with the extraordinarily unhelpful view of your filesystem as most Linux applications do. OK, some of them try to help in a feeble way by defaulting to /usr/local/bin, or /usr/local/sbin, or /usr/include, or wherever they think you might enjoy conducting a brute-force search for a binary executable. No, KeyTouch has an application chooser that uses your system menu! So you can select Internet -> Firefox like a normal person, instead of wasting time swearing.

The application chooser works the same way on the Key Settings tab.

The Preferences tab lists the installed plugins, and has a Download button to install new ones.

The KeyTouch Editor is what you use to map the keys on an unsupported keyboard. Just follow the instructions; it's easy. You will be asked to enter the name of each key, a keycode and a default action. Use whatever is printed on the keys for the key names. Key codes come from this list. (There is a newer PDF manual, but I could not get it to download from SourceForge.) Choose a key code that best matches the function of the key, and you may use each code only once.

The default action for each key is not what you want it to be, but its default action. You'll do your customizations later; what you're doing now is re-creating an accurate key map containing all the default functions. (Why can't the keyboard manufacturers do this? Maybe they're just not as smart as us.) The default action is an application or a plugin. The available plugins are on the Preferences tab of KeyTouch, as we already know. You want the plugin name and the function names, which you get by clicking the Information button. The plugin name and functions are case-sensitive.

After you have mapped all of your special keys and saved the output file, open KeyTouch and use Preferences -> Import to load your new keyboard file. Now it should show up in Keyboards -> Change, and you can get to work customizing it. After a suitable interval of torture-testing and refining your new keyboard file, it would be a lovely gesture to send it to the developer of KeyTouch, Marvin Raaijmakers, marvinr at users.sourceforge.net. He did the hard part, so why not pitch in?

Resources