5th value in xmodmap (was: ctrl-alt-2 as at (@))

Ingo Krabbe ikrabbe.ask at gmail.com
Sun Jun 7 04:40:21 PDT 2015


My researches had led me to the statements, that the way xmodmap specifies the keycode and
modifier combinations isn't flexible enough to describe modern Keyboards and the symbols that
are produced from them.

I assume its the "XKEYBOARD" X Server Extension that configures the keyboard through xkb files,
that should live somewhere near /usr/share/X11/xkb (system dependent).

To view your current configuration the command

	xkbcomp -xkb :0 - # produces a lot of output

. The files that affect this configuration can be found if you check the output of

	setxkbmap -print

. For example on my system that is

	xkb_keymap {
		xkb_keycodes  { include "evdev+aliases(qwertz)"	};
		xkb_types	 { include "complete"	};
		xkb_compat	{ include "complete"	};
		xkb_symbols   { include "pc+de(nodeadkeys)+inet(evdev)"	};
		xkb_geometry  { include "pc(pc104)"	};
	};

. When I want to find the produced symbols for that configuration I have to read the files
"symbols/pc", "symbols/de" and "symbols/inet". From the above output I can search the line
starting with 

	xkb_symbols "pc+de(nodeadkeys)+inet(evdev)"

. Each key on the keyboard is configured in such structure similar to

	key <AD01> {
		type= "FOUR_LEVEL_SEMIALPHABETIC",
		symbols[Group1]= [			   q,			   Q,			  at,	 Greek_OMEGA ]
	};

. The term "<AD01>" comes from the xkb_geometry files and is evaluated as

	<AD01> = 24;

here, so that is for keycode 24.

The interesting thing is the "type" field, that comes from the "compat/complete" file
here and contains the structure

	type "FOUR_LEVEL_SEMIALPHABETIC" {
		modifiers= Shift+Lock+LevelThree;
		map[Shift]= Level2;
		map[Lock]= Level2;
		map[LevelThree]= Level3;
		map[Shift+LevelThree]= Level4;
		map[Lock+LevelThree]= Level3;
		preserve[Lock+LevelThree]= Lock;
		map[Shift+Lock+LevelThree]= Level4;
		preserve[Shift+Lock+LevelThree]= Lock;
		level_name[Level1]= "Base";
		level_name[Level2]= "Shift";
		level_name[Level3]= "Alt Base";
		level_name[Level4]= "Shift Alt";
	};

. Don't let be confused from the "level_name" Alt, that contains no or even misleading information.
We need to search for the term "LevelThree", that is overdefined as

	interpret ISO_Level3_Shift+AnyOf(all) {
		virtualModifier= LevelThree;
		useModMapMods=level1;
		action= SetMods(modifiers=LevelThree,clearLocks);
	};
	interpret ISO_Level3_Shift+AnyOfOrNone(all) {
		action= SetMods(modifiers=LevelThree,clearLocks);
	};

and "ISO_Level3_Shift" is

	<LVL3> = 92;
	key <LVL3> {
		type= "ONE_LEVEL",
		symbols[Group1]= [ ISO_Level3_Shift ]
	};

. I haven't found why my keyboard produces keycode 92 for AltGr, though the layout
uses "<RALT> = 108;" so it should produce 108.

I leave that last question for anyone who knows even more.

After all I would say that the xkb configuration is too complex and bad documented, but
understandable in the end.

I would recommend to forget about xmodmap and use xkbcomp(1) and setxkbmap(1) to
temporarily modify the produced symbols. You can define more than FOUR_LEVEL symbols. I found
definitions with up to EIGHT_LEVEL types. Can you define even more?

Another left-over question is: Is there a default or configured "system directory" to overwrite
the "installation directory" settings in "/usr/share/X11/xkb", such as "/etc/X11/xkb"?

Regards,

Ingo Krabbe


> Regarding the ayer's discussion, it pop'ed up a small question re/ xmodmap;
> 
> if I do:
> 
> $ xmodmap -pke | fgrep ' 24 ='
> keycode  24 = q Q q Q at Greek_OMEGA at Greek_OMEGA
> 
> I see that the at-sign in my environment is assigned as the 5th keysym
> to the keycode 24 and Alt-gr q gives @, even more Alt-gr Shift q gives
> the Greek_OMEGA: ΩΩΩΩΩΩΩ (perhaps you need an UTF-8 terminal to see it
> correctly). So far so good. But why the man page of xmodmap(1) 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.
> 
> i.e. it says that four last values are unused? This is on my system with
> xorg-7.7 on FreeBSD 11-CURRENT.
> 
> Thanks
> 
> 	matthias
> -- 
> Matthias Apitz, guru at unixarea.de, http://www.unixarea.de/ +49-170-4527211	+49-176-38902045
> "Wenn der Mensch von den Umständen gebildet wird, so muß man die Umstände menschlich bilden."
> "Si el hombre es formado por las circunstancias entonces es necesario formar humanamente
> las circunstancias", Karl Marx in Die heilige Familie / La sagrada familia (MEW 2, 138)
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s




More information about the xorg mailing list