Mapping combo to key and key to combo

Glynn Clements glynn at
Thu Aug 27 13:37:59 PDT 2009

Thomas Dickey wrote:

> >>> I think maybe xmodmap or xbindkeys might be able to do something like that.
> >>
> >> Perhaps - but the windows-key may be a problem (iirc, unless _it_ happens
> >> to be one of the special modifiers such as shift- and control-, it won't
> >> work - someone might be able to clarify that).
> >
> > Usually the Windows key gets mapped to Super, which, in turn, is usually
> > Mod4.
> man xmodmap says
>         keycode NUMBER = KEYSYMNAME ...
>                 The list of keysyms is assigned to the indicated keycode (which
>                 may be specified in decimal, hex or octal and can be determined
>                 by running the xev  program).   Up  to  eight  keysyms  may  be
>                 attached  to  a  key, however the last four are not used in any
>                 major X server implementation.  The first keysym is  used  when
>                 no  modifier  key  is pressed in conjunction with this key, the
>                 second with Shift, the third when the Mode_switch key  is  used
>                 with  this  key  and  the  fourth when both the Mode_switch and
>                 Shift keys are used.
> ...from which I recall some comment that indicates that while you can 
> assign "any" key to be one of the extra modifiers, it's only the first 
> four in this table that can be received as a completely-reassigned keysym.
> Otherwise, you're relying on the application to interpret the modifiers 
> (as xterm does, for example - in addition to the translations resource). 
> That wouldn't be what OP was requesting.
> clarification on this point was what I was suggesting...

I think that Marius interpreted your previous comment as simply saying
"the Windows key has to be bound to a modifier to use it like a
modifier", rather than saying "it has to be one of the `special'
modifiers in order to have it affect the keysym".

As the xmodmap section cited above says, the only modifiers which
affect the keycode->keysym mapping are the shift modifier (and the
{num,caps,shift}-lock modifiers) and the Mode_switch/ISO_Level3_Shift
modifier. These are the ones which are used to select between the
multiple symbols which may be printed on a physical key.

The use of Shift/AltGr to affect the keycode to keysysm translation
allows libraries and applications to handle text input without needing
to know the details of the various keyboard layouts (e.g. Shift+2 is
"atsign" on a US keyboard but "quotedbl" on a UK keyboard). 

XLookupString() etc can just look at the keysyms without worrying
about where they came from.

Modifiers not related to text entry don't affect the keysym, but are
simply reported as modifiers in the event structure. (However,
modifiers which *do* affect the keysym are also reported as modifiers,
so applications which do their own low-level event processing need to
know that Shift+! == ! == Shift+1).

Glynn Clements <glynn at>

More information about the xorg mailing list