From bc8fef11f15c09b3e01203c9208c1e2e8a0e1788 Mon Sep 17 00:00:00 2001
From: Spike <126838489+Spike-from-NH@users.noreply.github.com>
Date: Sun, 18 Aug 2024 15:49:30 -0400
Subject: [PATCH] Modmap: Reorganize (#730)
Put new example in Examples section; put all overview material at start; use "modmap" for the modmap tag but "mapping" for the various subtags; set out each subtag separately; stop illustrating example mappings as complete modmap.
---
doc/Custom-layouts.md | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/doc/Custom-layouts.md b/doc/Custom-layouts.md
index 0e0dd30..fc9176d 100644
--- a/doc/Custom-layouts.md
+++ b/doc/Custom-layouts.md
@@ -104,32 +104,39 @@ Built-in strings that assign a special function to a key are described in [this
In a layout, a key value can also start with the `loc` prefix. These are place-holders; the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled.
## Modmap
-The ``...`` pair encloses custom mappings for modifier keys. The modmap is placed inside the ``...`` pair, but outside any row. A layout can have at most one modmap.
+The ``...`` pair encloses custom mappings for modifier keys. The modmap is placed inside the ``...`` pair, but outside any row. A layout can have at most one modmap. It can contain any number of mappings. Each mapping has an `a` property and a `b` property and maps the `a` key to the `b` key. Valid values are listed in [Possible key values](Possible-key-values.md).
+
+The following mappings are supported:
-A `` can contain any number of elements of the form:
```xml
```
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).
-
-The supported modmaps are: ``, `` and ``.
-
-The `` 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
-
+
```
+This means that when the Fn modifier is on, the key `before` is changed into `after`.
-The clockwise circle and the round-trip gestures are affected by both `` and `` modmaps. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
+```xml
+
+```
+This means that when the Ctrl modifier is on, the key `before` is changed into `after`. The `` mapping is special in that the Ctrl modifier is applied to `after` after the mapping.
-### Example
-Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following modmap:
+The clockwise circle and the round-trip gestures are affected by both `` and `` mappings. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
-
-
-
+### Examples
+① Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following mapping:
+
+```xml
+
+```
+② Cyrillic layouts have no V key. A layout can define Ctrl-V with the following mapping:
+
+```xml
+
+```
+This maps Ctrl+в to Ctrl+V—not to v.
## Portrait vs. landscape
Unexpected Keyboard remembers *separately* which layout has last been used in portrait and landscape orientation. So you may have one custom layout for portrait orientation, but another custom layout for landscape orientation, and Unexpected Keyboard will switch between them without your intervention.