Changing non-printing keys in keyboard layout

Marty Jack martyj19 at
Sun May 8 15:46:53 PDT 2011

On 05/08/2011 05:47 PM, Dotan Cohen wrote:
> Hi all, I'm trying to write a new keyboard layout to help with a
> manual disability. I have no problems moving the letters around but
> the non-printing character keys are being tenacious:
> How does one map Enter to a different key? The following did not have
> any effect:
> key <AC05> { [ enter                      ] };
> How does one prevent Capslock from being activated when the physical
> Capslock key is reassigned to a letter? I have the following:
> key <CAPS> { [ a,             A           ] };
> However, repeatedly pressing that key results in this output:
> aAaAaAaA
> This is because in addition to the letter, the caps state is being toggled!
> I have a similar issue with Shift, assigning it to Z and pressing the
> key results in both a Z _and_ a shift being activated:
> key <LFSH> { [ z,             Z           ] };
> How does one assign Caps Lock? The following did not have any effect:
> key <AB05> { [ caps_Lock   ] };
> How does one assign Esc? The following did not have any effect:
> key <AE05> { [ escape                     ] };
> I'm currently using Debian Squeeze with KDE. It is important to solve
> this issue with a keyboard layout as opposed to playing with the
> scancodes and keycodes because there are other users of the system and
> the computer needs to be able to switch on the fly to standard US,
> Hebrew, and Russian layouts.
> Thanks!

The keycode for what you're calling enter is spelled Return.

Look in /usr/share/X11/keysymdef.h at line 128 or thereabouts.  If you don't have that include file, install the X development headers.  This will help you find what the right spelling and capitalization are for anything you are interested in.  Keysyms are case sensitive, even though most things in the keyboard definition are not case sensitive.  I think Escape would work if you had it spelled with a capital E.

The setup for the modifier keys is in /usr/share/X11/xkb/symbols/pc at line 39 where it assigns the Shift meaning to Shift_L and Shift_R the left and right shift keys.  Shift_L and Shift_R are assigned to keycodes right above there to be whatever the keycodes <LFSH> and <RTSH> are on your keyboard model.  The Caps Lock assignment is there as well.

You can change which keys get assigned any of those meanings right there.

More information about the xorg mailing list