Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!
Most multimedia keyboards come with a Windows driver disk to handle the keyboard events on the extra keys, but Linux is often left out in the cold. Fortunately, Linux users can now turn to the hotkeys program for help.
Hotkeys maps extra keyboard keys to user-definable functions. With a little bit of work, multimedia keyboards will work fine under Linux. The first step is to install hotkeys. Simply compile the source file or install it from your chosen distribution, if available. Next, create a configuration file for your keyboard, if one doesn't already exist.
To create a configuration file, copy an existing keyboard configuration file and paste the name of the copied file in the /etc/hotkeys configuration file. Push various buttons on the keyboard to see what events are triggered, and then make sure the keycode mappings are correct.
Verify the mapping information by opening a terminal and launching xev. The xev command listens to keyboard events and provides codes based on key presses and mouse movements, plus it displays codes on the screen. One element of the xev output is the keycode, which is part of a bigger block of output beginning with "KeyPress event." The line of particular interest to you will begin like this:
state 0x10 keycode 178
This keycode value (178) corresponds to the button pushed—in this case, the "WWW" key.
By default, the configuration file uses XMMS to play music and Mozilla to handle Web and e-mail. However, you can modify the file to launch other programs.
Once you've configured hotkeys, you can begin using the multimedia keyboard. Start hotkeys by launching the hotkeys program. It will background itself and run as a service. For ease of use, consider adding it to a startup or login script.
Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.