xmodmap: different keys have different keycode semantics?

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 12 22:41:52 PST 2009


On Thu, Feb 12, 2009 at 01:51:46PM -0500, Nikolaus Rath wrote:
> Marius Gedminas <marius at gedmin.as> writes:
> > On Wed, Feb 11, 2009 at 04:19:57PM -0500, Nikolaus Rath wrote:
> >> I noticed a very strange thing about xmodmap. Apparently, the
> >> semantics of the
> >> 
> >>   keycode <nr> = <keysyms>
> >>   
> >> command depend on the keycode.
> >
> > Yes.
> >
> > You may find reading about XKB enlightening: http://pascal.tsu.ru/en/xkb/
> > or http://www.charvolant.org/~doug/xkb/
> >
> > Specifically, the type assigned to a keycode determines how the various
> > shift keys select a level.
> 
> Thanks a lot. It seems that the use of xmodmap is actually deprecated,
> is it?
> 
> After reading the website, I was able to translate most of my xmodmap
> rules into a new xkb symbol file. However, I am facing problems in
> setting up the modifiers.
> 
> I am setting them up as follows:
> 
> ,----
> | partial
> | default
> | alphanumeric_keys
> | xkb_symbols "niko" {
> | 
> |     // Meta
> |     key <RALT> {
> |       type[Group1]="ONE_LEVEL",
> |       symbols[Group1] = [ Meta_R ]
> |     };
> |     key <LALT> {
> |       type[Group1]="ONE_LEVEL",
> |       symbols[Group1] = [ Alt_L ]
> |     };
> |     modifier_map Mod1   { <LALT> };
> |     modifier_map Mod3   { <RALT> };
> | 
> |     // Clean up
> |     modifier_map Lock   { Caps_Lock };
> | };
> `----
> 
> (note that <CAPS> is actually bound to Control_L). Unfortunately, the
> result looks like this:
> 
> ,----
> | nokile:~$ xmodmap 
> | xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
> | 
> | shift       Shift_L (0x32),  Shift_R (0x3e)
> | lock        Control_L (0x42)
> | control     Control_L (0x25),  Control_L (0x42)
> | mod1        Alt_L (0x40),  Meta_R (0x71),  Meta_L (0x9c)
> | mod2        Num_Lock (0x4d)
> | mod3        Alt_L (0x40)
> | mod4        Super_L (0x7f),  Hyper_L (0x80)
> | mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x6d),  ISO_Level3_Shift (0x7c)
> `----
> 
> (and obviously this causes a lot of problems). What 
> what I would like to have is *no* key bound to the lock modifier ,
> *only* the Alt_L key bound to mod1 and only the Meta_R key bound to
> mod3.
> 
> How can I accomplish that? Is there some way to clean up the modifier
> table (like with xmodmap)? And why isn't the above file working as I
> expect? (The file is actually read in, because with xev I can see that the
> keysym of <RALT> changes to Meta_R as desired).

the rules have funny ways of combining themselves, so your best guess is to
look at the output of xkbcomp -xkb :0 - and compare what it says.
For example, an explicit NoSymbol is overwritten by a symbol pulled in from a
different data set. I don't think there's a way of avoiding that.
 
Cheers,
  Peter



More information about the xorg mailing list