Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between iso_level3_shift and latch

Tags:

keyboard

x11

What is the difference between ISO_Level3_Shift and ISO_Level3_Latch, in, for example, the level3 config file, found (in archlinux, and many other distros, I'm sure) at /usr/share/X11/xkb/symbols.

For example, I added this entry to a custom keyboard I'm working on (for logicians, don't worry about it, ⊥ → awesome).

// make right control do level3 shift stuff
default partial modifier_keys
 xkb_symbols "rctrl_switch" {
  key <RCTL> {
    type[Group1]="ONE_LEVEL",
    symbols[Group1] = [ ISO_Level3_Shift ]
    };
  include "level3(modifier_mapping)"
};

It works as expected (holding down right control gives me access to level 3 symbols,e.g., mostly unicode code points I have for a us-intl layout variant), but I'm wondering why some of the entries use ISO_Level3_Latch, and what that even means.

like image 838
mbunit Avatar asked Feb 07 '13 04:02

mbunit


1 Answers

A shift-style modifier works in such a way that you have to hold it while pressing the other key for the key to be modified. That's how the regular capital shift key works on usual keyboards.

A latch-style modifier does the same, but contrary to a shift-style modifier, if it's released before another key is pressed, that modifier is latched, which means the next key you'll press will be modified. In addition, if pressed while latched, the modifier is locked until the modifier key is pressed again.

Example using the regular shift that goes to capital letters. Consider the following order of keystrokes :

- Press a
- Release a
- Press & release space
- Press shift
- Press a
- Release a
- Press a
- Release a
- Release shift
- Press & release space
- Press shift
- Release shift
- Press a
- Press a
- Press & release space
- Press shift
- Release shift
- Press shift
- Release shift
- Press a
- Press a
- Press a
- Press shift
- Release shift
- Press a

If shift is set to shift-style you'll get the following output :

a AA aa aaaa

If shift is set to latch-style you'll get the following output :

a AA Aa AAAa

Because after the press-release cycle before the third group, shift is latched, and that latch is consumed when you hit the a key. In the fourth group, pressing the latch again while latched sends you in lock mode.

like image 80
Jean Avatar answered Sep 22 '22 07:09

Jean