next up previous Link to 'computer' page
Next: Using the `Windows' key Up: Keyboard Previous: Keyboard

Custom keyboard layout

There is a defect in the Japanese keyboard layout definition, since it misses a definition for the `Win' key. Quite bizarrely, Linux has separate definition files for when the keyboard is used in a console (I think in /usr/share/kbd/keymaps/) and for X/Xorg (/etc/X11/xkb/symbols/).

Helpful hints to create custom keyboard layouts are Creating custom keyboard layouts for X11 using xkb and An unreliable guide to xkb configuration.

First, as root, change to the /etc/X11/xkb/symbols directory. Copy jp to jp_win. Edit jp_win by adding the lines...

key <LWIN> { [ F15  ] };

key <MENU> { [ Menu ] };

...before the final closing brace. I defined the left Window key as F15, rather than Super_L. This is because Super_L is defined as a modifier key, and cannot be used by itself to activate the Launch menu on KDE 3.4 (but can be used alone on KDE 3.3). I left <MENU> to be defined as `Menu' rather than F17, since KDE uses Menu to launch the context menu. The CV50 does not have a Super_R (right Windows) key.

You will also need to modify /etc/X11/xkb/rules/xorg.lst. Under the `layout' section, add the line `jp_win Japanese (win)' below the `jp Japanese' line.

You also need to modify /etc/X11/xkb/rules/xorg. Under `* jp =jp' add the line `* jp_win = jp_win'

You can now choose the jp_win layout from the KDE's control centre (Regional and Accessability -- Keyboard layout).

This now leaves the problem that the left Window key generates F15 from the Japanese (jp_win) layout, but generates Super_L from the en_US layout. I also needed to modify the us layout for my Honeywell keyboard anyway, because it has its backslash|bar key to the left of the backspace key, rather than below the backspace key. I copied the /etc/X11/xkb/symbols/pc/pc file to pc.original and proceeded to edit the `pc' file. There may be a more elegant way to fix this problem without modifying the `original' file...

Add the line...

key <AC12> { [ backslash, bar ] };
below key <AE12> in the `basic' section. It is not AE13 (as it is on a pc104 keyboard), because we are using the jp106 keycode to keysym conversion (details of which can be found in /etc/X11/xkb/keycodes/xfree86, jp106 section). The backslash key on the jp106 keyboard is found three keys to the right of the L key.

Change the line in the ``pc104'' section (I have no idea where pc104 is referenced to from en_US)...

key <LWIN> { [ Super_L ] };
to

key <LWIN> { [ F15 ] };-+
To activate all these changes, you need to re-load the keymaps. This seems to happen if you use the Control Centre (Regional and Accessability -- Keyboard layout), move the en_US and jp_win keymaps from `active' to `available', click the `Apply' button, then move the en_US and jp_win keymaps back to `active' again.


next up previous Link to 'computer' page
Next: Using the `Windows' key Up: Keyboard Previous: Keyboard
David Pat Shui Fong 2007-05-31