Changing non-printing keys in keyboard layout

Dirk Wallenstein halsmit at
Mon May 9 02:11:59 PDT 2011

On Mon, May 09, 2011 at 11:42:37AM +0300, Dotan Cohen wrote:
> On Mon, May 9, 2011 at 11:15, Dirk Wallenstein <halsmit at> wrote:
> > To change modifiers you have to edit the modifier_map entries, too.
> > They look something like this:
> >
> >    modifier_map Mod1 { <LALT> };
> >    modifier_map Shift { <LFSH> };
> >    modifier_map Control { <LCTL> };
> >    modifier_map Lock { <CAPS> };
> >
> > For example, replace the last line with:
> >
> >    modifier_map Lock { <AB05> };
> >
> Thanks, Dirk. Is <AB05> called a keycode? I will use that term for
> purpose of discussion below, please tell me the correct term if it's
> not!

It's a "symbolic name" and equals a keycode.  They are assigned in the
keycode section, and everywhere else these symbolic names are used
instead of numbers.

> I'm having a hard time figuring out what the keycodes of the bottom
> keyboard row are. For instance, what is the keycode currently assigned
> to L_Alt? Where would I find that? I need them for all the modifier
> keys. I tried looking in the remaining files in ~/symbols but I can't
> find that info.

As long as you are testing I would recommend working with a complete
keymap. You can save the current map in a file with:
  xkbcomp $DISPLAY keymap.xkb
and load it after editing with:
  xkbcomp keymap.xkb $DISPLAY 

At the top of the file is the keycode section where symbolic names are
assigned to keycodes.  You can easily exchange keys there.
Find out keycodes by executing 'xev' and translate them to symbolic
names to find the configuration for it. For example:

>     key <AB06> { [ Super_L,       Super_R     ] };
>     key <LCTL> { [ Control_L                  ] };
>     key <AB05> { [ 5                          ] };

Inside the brackets are keysyms.  They can be translated to strings,
like '5' in the case of the keysym XK_5, or they are tied to vmods like
in the case of Super_L.  A modifier_map entry would connect such a vmod
to a real modifier and thereby activate it.


More information about the xorg mailing list