Enlightenment Extended Keyboard Howto

If you have a keyboard with additional keys beyond the standard 103/104 keys, here is how to enable those keys under Enlightenment.

Step 0. Woops! keyboard driver changed in kernel 2.6. The extra keys will likely result in an error in /var/log/messages of the form:

Jan 16 12:16:34 quickest kernel: atkbd.c: Unknown key released (translated set 2, code 0xa5 on isa0060/serio0).
Jan 16 12:16:34 quickest kernel: atkbd.c: Use 'setkeycodes e025 ' to make it known.
My thanks to stef70 at http://www.linuxgazette.com/node/9028. To get these keys back you have to find the keycode for setkeycodes. Use this file, keycodes, and this script, calc-scancode, to automate the calculation. Basically, tail -f /var/log/messages, watch for the missing scancode e0##, and run calc-scancode ##. Commands are added to rc.scancode, which you want to put in your system start-up scripts.

Step 1. Identify the keycodes. Run "xev", and with xev the active window press the key and note the keycode it generates.

Step 2. If the key has only a numeric code, and no "keysym" name, you will have to map the code to an established keysym. For my IBM RF-wireless keyboard, I have an additional row of keys labeled "EMail", "Internet", "Search", etc. The command "xmodmap -e 'keycode 165 = XF86Mail' maps the "EMail" key to a symkey in the file /usr/X11R6/include/X11/XF86keysym.h (you take out the "XK_" part). The keyboard also has 2 additional forward/back keys with a page icon. I ended up with these assignments which could be put into a file, ~/.xmodmaprc, and run like "xmodmap ~/.xmodmaprc", except in RedHat, the file must be named ~/.Xmodmap. NOTE: the keysyms must be defined before enlightenment starts.

   keycode 146 = XF86Start
   keycode 151 = XF86Search
   keycode 152 = XF86HomePage
   keycode 158 = XF86AudioPrev
   keycode 160 = XF86AudioPlay
   keycode 162 = XF86AudioNext
   keycode 164 = XF86Sleep
   keycode 165 = XF86Mail
   keycode 166 = XF86Calendar
   keycode 178 = XF86Community

Step 3. Copy the default keybindings file from /usr/share/enlightenment/config/keybindings.cfg to ~/.enlightenment.

Step 4. Edit ~/.enlightenment/keybindings.cfg and assign actions to these keysym names. Add somewhere in the section that starts:

      __ACLASS __BGN
stanzas that look like this:

      __KEY XF86Mail
      __ACTION __A_EXEC evolution

Step 5. Make some useful commands you want to run at a touch of a button, eg, my search button now runs a command called "google" that does this:


	SEARCHFOR=`xclip -o`
	exec mozilla http://www.google.com/search?q=$SEARCHFOR
(you will probably have to download and install "xclip") Now any text that is highlighted or in my X windows clipboard will become a search string at www.google.com! I think that is pretty damn cool.

The other keys I defined start evolution, mozilla, ldap (addressbook), xmms, webdav log, tkman, and suspendmode. The forward/backward keys I mapped to next/previous track in xmms.

Step 6. Restart Enlightenment for changes to take effect.