Hack 29. Get Hotter Hotkeys with LinEAK
LinEAK turbo charges the whole concept of customizing how your Internet/multimedia keyboard works.
This hack will show you how to adopt the modern equivalent of Hotkeys. LinEAK is a combination of packages, including the main daemon service and several plug-ins. It's a bit quirky and doesn't always launch successfully (at least in this author's experience), but it has support for far more keyboards than Hotkeys. And because Hotkeys hasn't advanced much over the years, it isn't likely to catch up unless someone regains interest in it. LinEAK, on the other hand, is being improved on a regular basis.
As of this writing, you can get Debian packages for some of the programs that make up LinEAK at http://lineak.sourceforge.net/, and you can get the source code for all the packages from the same site and compile the programs and plug-ins yourself. I compiled my own and it was a cinch. The RPM packages at this site are out-of-date but might be current by the time you read this.
Until that time, you can find a variety of RPM packages for LinEAK designed for Mandrake and other distributions at http://rpm.pbone.net/index.php3?stat=3&search=lineakd&srodzaj=3. And you can also search http://www.rpmfind.net. Make sure you have XOSD and XOSD development libraries installed if you want to enjoy the on-screen display feature. [Hack #26] provides more information about XOSD. For example, the volume control shown in Figure 4-2 is one of the nice features LinEAK shares with Hotkeys [Hack #28] .
Figure 4-2. LinEAK's on-screen volume display, which is nice-looking as long as you use the built-in volume definitions
The following programs comprise LinEAK as it stands now:
At minimum, install lineakd, lineak_defaultplugin, and lineak_xosdplugin. If you can't find packages for your distribution, download the source code and then compile and install the programs using these commands (assuming you place your source code in /usr/local/src):
# cd /usr/local/src/lineakd-0.8.1 # ./configure # make # make install # cd /usr/local/src/lineak_defaultplugin-0.8.1 # ./configure # make # make install # cd /usr/local/src/lineak_xosdplugin-0.8.1 # ./configure # make # make install
Now log in as a regular user and type the following command to get a list of the supported keyboards:
$ lineakd -l (The complete list is 3 pages long, this is just the first few lines) LinEAK v0.8.1 -- supported keyboards: [TYPE] [Full name] A4-KBS21 A4Tech Wireless Desktop KBS-21533RP & Office/Multimedia Keyboard A4-KBS8 A4Tech KBS-8 A4-RFKB23 A4Tech RFKB-23 A4-RFKB25 A4Tech RFKB-25 (KBS-2548RP & KBS-2548RPC) ACE-6512UV Acer 6512-UV ACE-TM290 Acer Laptop/notebook Travelmate 290LCi ACEAKV12 Acer AirKey V (12 keys) ADEL-9805 Adesso EL-9805 APK7 Apple Pro Keyboard (7 keys) BEN-AM805 BenQ AM805
That kind of beats the tar out of Hotkeys support, doesn't it?
Find your keyboard in the list. For example, the code for the Logitech Elite keyboard is LTCElite. Now type this command to create a default configuration file for your keyboard (substitute LTCElite with the code for your keyboard):
$ lineakd -c LTCElite
The -c option creates a default configuration file, lineakd.conf, for the Logitech Elite keyboard and places the configuration file in the ~/.lineak directory. Fire up your favorite editor, and customize this file's settings to your heart's content. Here's a sample configuration I created for my Logitech Elite keyboard:
# LinEAK - Linux support for Easy Access and Internet Keyboards # Copyright (c) 2001,2002, 2003 Sheldon Lee Wen <email@example.com> # and Mark Smulders <Mark@PIRnet.nl> # http://lineak.sourceforge.net # # lineakd configuration file # # example key configuration: # play = "xmms --play-pause" # eject = EAK_EJECT # # Lineakd supports the following modifier keys: # control alt shift mod2 mod3 mod4 mod5 # Normally /dev/cdrom, but UDEV likes /dev/cdroms/cdrom0 CdromDevice = /dev/cdroms/cdrom0 Display_align = center Display_color = 77FF00 Display_font = "-adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-*-*" Display_hoffset = 0 Display_plugin = xosd Display_pos = bottom Display_soffset = 1 Display_timeout = 6 Display_voffset = 50 KeyboardType = LTCElite MixerDevice = /dev/mixer Screensaver = conffilename = /home/nicholas/.lineak/lineakd.conf keystate_capslock = keystate_numlock = keystate_scrolllock = Arrow = Email = "thunderbird" Favorites = "firefox" Go = "firefox -remote 'openURL( )'" Media = "cdeject" Messenger = Mute = "EAK_MUTE" MyHome = Next = "cdplay +" Play = "cdplay" Pause = "cdpause" Previous = "cdplay -" Search = "firefox -remote 'openURL(http://www.google.com,new-tab)'" Shopping = Sleep = Stop = "cdstop" VolumeDown = "EAK_VOLDOWN" VolumeUp = "EAK_VOLUP" Webcam = iTouch =
Note the use of some built-in commands, such as EAK_MUTE, EAK_VOLUP, and EAK_VOLDOWN. These are far more preferable when figuring out how to configure a command-line mixer to do the same operations. Unfortunately, LinEAK doesn't automatically insert these as the default settings for the Mute, VolumeUp, and VolumeDown parameters (it leaves the definitions empty), so unless you know these generic settings exist, you might waste a lot of time figuring out how to create a command to mute your sound driver or change the volume. Well, now that you know they exist, by all means, use them!
Outside of the internal EAK_ commands, the audio CD controls in this example are driven by a command-line package of programs called cdtool, created by a host of contributors but currently maintained by Max Vozeler. You can download cdtool from http://hinterhof.net/cdtool. You can choose any CD player that can be controlled via the command line, but it's nice not to have an actual graphical CD player clutter the screen when all the controls are already on the keyboard.
You can thank Mark Smulders (firstname.lastname@example.org), the original author, for this fine piece of software. Sheldon Lee Wen (email@example.com) is the current maintainer and developer of the latest versions, and wrote plug-ins from the ground up. Phil Woodland (firstname.lastname@example.org) is the contributions coordinator and maintainer. Finally, Chris Peterson (email@example.com) does the RPM packaging for LinEAK.