I just discovered that I couldn't add more than 4 layouts for my keyboard. Googling revealed that it was a universal limit (at least for GNU/Linux) and the only way(s) to get around it was to use some hackish way with scripts. Is there really a technical reason behind this? If yes, what is it?

  • Answer is here: askubuntu.com/questions/107945/… – Rinzwind May 1 '13 at 9:58
  • This limitation still exists on some desktops at the end of 2018. Gnome allows me to configure more layouts but XFCE does not. I assume that at least Gnome solved the problem mentioned in htorque's answer and code in XFCE is behind of what is possible upstream. – LiveWireBT Dec 26 '18 at 4:05

Quoting Peter Hutterer (Red Hat employee working on X.Org):

Some information about this feature and why it hasn't been implemented yet: Te 4 group limit is forced by the protocol wire format. support for more than 4 groups can only be added by adding additional requests and events to XKB and rewriting clients to switch to this new XKB version. In addition, compatibility to the old protocol must be ensured so that current XKB clients will still function correctly with the new XKB version.

This is both complex and very time-consuming. Volunteers to tackle this problem are of course very welcome.


It's encoded in some bits on the protocol, with the other bits being used for other information. so you need extra bytes in the requests/events for anything above 4, and adding extra bytes requires bumping the protocol. And then you have to deal with those clients that only understand 4 groups and what to do with them if a keyboard is on group 5.

Why we don't have a hack above this layer - I don't know... this must be the lamest limitation ever. :D

  • It is all the more strange because you can actually use more than 4 - by using scripts. – Mussnoon Jan 16 '11 at 18:00
  • If you're on unix.se, can you please also post the answer there so that I can accept it there as well: unix.stackexchange.com/questions/5963/… – Mussnoon Jan 16 '11 at 18:01
  • I'm not, gotta answer it yourself. ;-) – htorque Jan 16 '11 at 18:19

I frequently write in English, German, Swedish and Chinese. This is four, but I am learning Russian as well and would appreciate the extra toggle via the GUI. Scripts is a workable resolution in the meantime:


One might note that with Russian, one has the option of either the 'standard' Russian keyboard layout, or a much more convenient (for those of us learning) phonetic layout paired to QWERTY.

Also, many of us use some form of Dvorak, which also takes a position.

Hence, my computer looks like this:

Keyboard layouts:

USA Dvorak (programmer) Swedish German Russian Russian phonetic

and there is an additional keyboard icon with an ibus toggle for Chinese Pinyin.


The protocol sets aside two bits for keyboard switching. This is two more than many people need. Most of the users I have seen switching keyboard layouts use two; a local layout and and international layout. The international layout usually handles composition of all require keys. This leaves one excess bit. I have seen users with three layouts, but usually one is never used.

I would be interested in what you are doing that requires more than four layouts, and how you work with constantly changing keymapping. I find it difficult to get users used to two layouts, even when it solved problems they have with internationalization.

  • 4
    With all due respect, that's not a proper answer. Linguists, language enthusiasts and bi-lingual or tri-lingual people who are learning one or two other languages, need this feature. It can also be needed for testing or for trying out new layouts such as Dvorak. But it doesn't really matter why people need more than 4 input layouts. The fact of the matter is that they do. – Teekin Feb 21 '13 at 13:38
  • @HelgiHrafnGunnarsson Protocols like this were created when bandwidth was quite limited and bits were allocated sparsely. I believe my post explains the reasoning which was likely used. I work with many bi-lingual people who work with one layout. There are many multi-lingual layouts available, which may may typing easier than changing layout every time you switch languages. – BillThor Mar 14 '13 at 12:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.