How do FOUR_LEVEL_SEMIALPHABETIC xkb keys work?

What's with this LevelThree business?

In the model expounded by ISO/IEC 9995, which is the international standard (set) that covers computer keyboards, keys can have one or more levels. What you may think of as "modifier keys" select amongst the available levels, sometimes in a complex fashion.

(Think of the operation of a mechanical typewriter, where the shift key actually moved part of the mechanism to a different level, and where the shift key often mechanically unlocked a "shift lock". Then mix in the ideas of other kinds of locks, such as ones that only apply to subsets of the keyboard such as the main block or the calculator pad.)

Sometimes the levels are what you see physically engraved upon the keys, sometimes (especially in the case of U.S. and European engravings and alphabetic keys) one or more of the levels are implied but not explicitly engraved.

Level 1 is unshifted; level 2 is the result of a ⇧ Shift modifier, a shift latch, a ⇫ Shift Lock, a Num Lock, or a ⇬ Caps Lock; and level 3 is the result of a "level three modifier" of some kind.

As you can see from this configuration file, a "level 4" convention exists (an extension to ISO/IEC 9995 proper) that is the result of applying both level 2 and level 3 shifts at the same time.

(This convention presupposes that this combination is even available in the first place. In some keyboard layouts, there is no ⇨ Group 2 key, and the keys that would otherwise select "level 4" instead select the second group, which is an entire alternative layout complete with its own set of 3 shift levels. On actual keytops, group 2 is a second column of one to three engraved symbols on the right. A lot of complexity in some systems results from trying to pretend that group 2 does not exist, whereas level 4 does.)

A level three modifier is generally the ⇮ AltGr key, to the right of the spacebar. On some keyboards the key that generates the relevant HID code, down the wire from the keyboard to the main unit, is labelled ⌥ Option and its physical position (still on the right) is slightly different. Software sees it as the same key, whichever the engraving and physical position. Do not, by the way, confuse it with the similar key that is to the left of the spacebar. That is a different key.

Not all software keyboard layouts make this key into a level modifier, however. What keys are modifier keys is (with one exception) entirely determined by the software keyboard layout. In some software keyboard layouts the key in that position is treated as another ⎇ Alt. If this is the case, one has no way to type a level 3 shift, absent using another keyboard layout or patching one's current keyboard layout so that some key or combination of keys produces a level 3 shift.

In a SI 1452 layout, ⇮ AltGr is indeed the level 3 shift, and with it you should be able to type all of the Niqqud. I suspect that you have conflated ⎇ Alt and ⇮ AltGr.

Further reading

  • https://unix.stackexchange.com/a/391968/5132

The LevelThree modifier is essentially another Shift. It's used on certain keyboard layouts. For instance, when I'm typing with a Swiss keyboard layout, I can use the AltGr key to get access to some symbols. AltGr+2 produces @, for instance. It's mostly used because Swiss keyboards need German (ä, ö, ü etc.), as well as French symbols (é, è, ê etc.), so there are simply more characters to type.

If it isn't mapped in your keyboard layout, you could map it yourself by creating a new keytype, see this answer that covers how to do it: how to bind AltGr to <Ctrl> + <Alt>

Quick explanation on why it's calledFOUR_LEVEL_SEMIALPHABETIC: ALPHABETIC key types use Shift and CapsLock modifiers. Shift and CapsLock are not identical in ALPHABETIC types (as opposed to TWO_LEVEL types). E.g. on a Swiss layout, Shift+a produces A and CapsLock and a produces A, so it's a key using TWO_LEVEL. However, ä, which is its own key on a Swiss keyboard, turns into à when used with Shift, but into the capital Ä when used with CapsLock.

FOUR_LEVEL just means it uses even more levels. Shift+LevelThree activates the fourth level, as you can see in your type definition. I'm not quite sure why it's called SEMIALPHABETIC, but it's probably got something to do with how exactly the different modifiers cancle out. The documentation here says that FOUR_LEVEL_ALPHABETIC types should use Lock+Shift+LevelThree for a third level symbol, but in your example it produces a fourth level. In the end the naming is fairly arbitrary anyway.