This question should probably go to retrocomputing since people should use XKB, but I am really curious how did they latch group switching with xmodmap / XChangeKeyboardMapping().

I read xmodmap man and X11 lib documentation, and it seems that to have, say, English and Russian keyboard layout you need to map keysyms to some keycode (like [code_for_letter_l] --> XK_l XK_L XK_Cyrillic_de XK_Cyrillic_DE) and then map some keycode to MODE_SWITCH.

Pressing this code along with L gives russian letter "Д".

But how can I latch it? There is Lock modifier, but it only could be used with XK_Caps_Lock keysym (and ShiftLock which I do not understand).

Adding lock to MODE_SWITCH has no affect.

With linux console keymap I can add group to, say, AltGr and then add some keycode to AltGr_Lock to make it latch. And it works. But how do I do it in X?

I checked several modmaps for cyrillic and other non-latin layouts (ancient distros have a lot of them) and in all cases people either used capslock for it or did not have lock/latch at all.

So, I came to idea that is was not possible to switch layout with keys like "CTRL+Shift" before XKB (before 1996?), but is sounds ridiculous.
Am I right?

1 Answer 1


First of all this is called lock becase latch means key will only affect next key.

There is no way to lock group in Core protocol but XKB extensions adds some keys according to ISO/IEC 9995.

XKB, Appendix C. New KeySyms: ISO NEXT GROUP keysymdefs.h

#define XK_ISO_Next_Group 0xfe08

So, I added keycode 133 = ISO_Next_Group_Lock to ~/.xmodmap and not Win key switches my groups

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .