Ubuntu – Why is there a 4-layouts limit for keyboards

keyboardkeyboard-layout

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?

Best Answer

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