I would like you to explain the internal mechanism of the "Keyboard Layout Options" from the aspect of the remapping of scancode
, keycode
, or keysym
. I am talking about the GUI "Keyboard Layout Options" control panel. I am particularly interested in Ubuntu MATE 20.04.
On Ubuntu MATE 20.04, the "Keyboard Layout Options" is located in the "Control Center" as shown below. Within "Keyboard Layout Options", I am particularly interested in "Ctrl is mapped to Win and the usual Ctrl keys", and "Swap Left Win with Left Ctrl".
Control Center > Hardware >
Keyboard > Layout tab > Options... >
Keyboard Layout Options
Alt/Win key behavior
(o) Ctrl is mapped to Win and the usual Ctrl keys
Ctrl position
[v] Swap Left Win with Left Ctrl
On Linux, there are three levels to identify keys -- scancode, keycode, and keysym. The scancode is the lowest level, and is what the keyboard sends to the computer. The keycode is the mid level. The keysym is the highest level.
Scancodes are more closely bound to positions on the keyboard than to the letters printed on the keys. For example, the key on which Y is printed on US keyboard has Z printed on it on European keyboard. However, the scancode is always the same no matter whether the key has Y printed on it on US keyboard or Z printed on it on European keyboard.
Commonly on Linux, there are two levels of mappings on Linux: the mapping from scancode to keycode, and the mapping from keycode to keysym. Thus, commonly on Linux, remapping of keys means either the modification of the scancode-to-keycode mapping or the modification of the keycode-to-keysym mapping.
On MS Windows, however, things are different from Linux. If I remember correctly, Windows lacks keysym. Nevertheless, scancode is the lowest level on Windows as well. On Windows, remapping of keys does not mean the modification of the scancode-to-keycode mapping but means the creation of extra mapping from scancode to scancode.
I would like to know whether the "Keyboard Layout Options" on Ubuntu MATE 20.04 is implemented as:
modification of the scancode-to-keycode mapping
modification of the keycode-to-keysym mapping
creation of extra mapping from scancode to scancode
or anything else (explain)
As stated above, I am particularly interested in "Ctrl is mapped to Win and the usual Ctrl keys", and "Swap Left Win with Left Ctrl".