doc: Document the <ctrl /> modmap

This commit is contained in:
Jules Aguillon 2024-07-26 00:04:57 +02:00
parent 29b4b665dc
commit 3967fb8a9f

View File

@ -106,15 +106,23 @@ In a layout, a key value can also start with the `loc` prefix. These are place-h
## Modmap ## Modmap
The `<modmap>`...`</modmap>` pair encloses custom mappings for modifier keys. The modmap is placed inside the `<keyboard>`...`</keyboard>` pair, but outside any row. A layout can have at most one modmap. The `<modmap>`...`</modmap>` pair encloses custom mappings for modifier keys. The modmap is placed inside the `<keyboard>`...`</keyboard>` pair, but outside any row. A layout can have at most one modmap.
A modmap can contain the following tags, each of which must have an `a` and a `b` property: A `<modmap>` can contain any number of elements of the form:
* `<shift a="before" b="after" />` If the Shift modifier is on, the key `before` is changed into `after`. ```xml
* `<fn a="before" b="after" />` If the Fn modifier is on, the key `before` is changed into `after`. <shift a="before" b="after" />
```
This means that when the Shift modifier is on, the key `before` is changed into `after`.
Valid values for `before` and `after` are listed in [Possible key values](Possible-key-values.md). Valid values for `before` and `after` are listed in [Possible key values](Possible-key-values.md).
There can be as many of these tags inside `<modmap>` as needed. The supported modmaps are: `<shift />`, `<fn />` and `<ctrl />`.
The clockwise circle and the round-trip gestures are affected by both Shift and Fn modmaps. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead. The `<ctrl />` modmap is special in that the built-in Ctrl modifier will then be applied to `after`.
For example, this will map Ctrl+в to Ctrl+V (not to v):
```xml
<ctrl a="в" b="v"/>
```
The clockwise circle and the round-trip gestures are affected by both `<shift />` and `<fn />` modmaps. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
### Example ### Example
Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following modmap: Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following modmap: