From 3893d50e13c0ed8bbe93e7f529c7403dc89b4752 Mon Sep 17 00:00:00 2001 From: measlesbagel <49631653+measlesbagel@users.noreply.github.com> Date: Mon, 5 Apr 2021 19:04:38 -0400 Subject: [PATCH 1/2] Docs: added mod morph page (#749) * docs(behaviors): add mod-morph doc page * docs(behaviors): add mod-morph doc page * docs(mod-morph): add note about sent modifiers * docs(mod-morph): fixed prettier formatting --- docs/docs/behaviors/mod-morph.md | 74 ++++++++++++++++++++++++++++++++ docs/sidebars.js | 1 + 2 files changed, 75 insertions(+) create mode 100644 docs/docs/behaviors/mod-morph.md diff --git a/docs/docs/behaviors/mod-morph.md b/docs/docs/behaviors/mod-morph.md new file mode 100644 index 00000000..cbb9a569 --- /dev/null +++ b/docs/docs/behaviors/mod-morph.md @@ -0,0 +1,74 @@ +--- +title: Mod-Morph Behavior +sidebar_label: Mod-Morph +--- + +## Summary + +The Mod-Morph behavior sends a different keypress, depending on whether a specified modifier is being held during the keypress. + +- If you tap the key by itself, the first keycode is sent. +- If you tap the key while holding the specified modifier, the second keycode is sent. + +## Mod-Morph + +The Mod-Morph behavior acts as one of two keycodes, depending on if the required modifier is being held during the keypress. + +When the modifier is being held it is sent along with the morphed keycode. This can cause problems when the morphed keycode and modifier have an existing relationship (such as `shift-delete` or `ctrl-v` on many operating systems). + +### Configuration + +An example of how to implement the mod-morph "Grave Escape": + +``` +/ { +behaviors { + gresc: grave_escape { + compatible = "zmk,behavior-mod-morph"; + label = "GRAVE_ESCAPE"; + #binding-cells = <0>; + bindings = <&kp ESC>, <&kp GRAVE>; + mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>; + } + +}; + + keymap { + ... + } +} +``` + +Note that this specific mod-morph exists in ZMK by default using code `&gresc`. + +### Behavior Binding + +- Reference: `&gresc` +- Parameter: None + +Example: + +``` +&gresc +``` + +### Mods + +This is how you determine what modifiers will activate the morphed version of the keycode. + +Available Modifiers: + +- `MOD_LSFT` +- `MOD_RSFT` +- `MOD_LCTL` +- `MOD_RCTL` +- `MOD_LALT` +- `MOD_RALT` +- `MOD_LGUI` +- `MOD_RGUI` + +Example: + +``` +mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>; +``` diff --git a/docs/sidebars.js b/docs/sidebars.js index 6761b19b..4ae23c59 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -22,6 +22,7 @@ module.exports = { "behaviors/misc", "behaviors/hold-tap", "behaviors/mod-tap", + "behaviors/mod-morph", "behaviors/sticky-key", "behaviors/sticky-layer", "behaviors/reset", From fadb50867147c935b912b2afbfebd9734ef00ccb Mon Sep 17 00:00:00 2001 From: Michael van Eerd Date: Thu, 15 Apr 2021 10:31:07 +0200 Subject: [PATCH 2/2] fix(docs) omit layers -1 example, clarify it defaults when omitted (#757) * fix(docs) omit layers -1 example, clarify * comment, simplify description * remove 'the' --- docs/docs/features/combos.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/docs/features/combos.md b/docs/docs/features/combos.md index 653fc6e9..1a19cfe4 100644 --- a/docs/docs/features/combos.md +++ b/docs/docs/features/combos.md @@ -18,7 +18,6 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod timeout-ms = <50>; key-positions = <0 1>; bindings = <&kp ESC>; - layers = <-1>; }; }; }; @@ -28,7 +27,7 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod - The `compatible` property should always be `"zmk,combos"` for combos. - `timeout-ms` is the number of milliseconds that all keys of the combo must be pressed. - `key-positions` is an array of key positions. See the info section below about how to figure out the positions on your board. -- `layers = <0 1...>` will allow limiting a combo to specific layers. this is an _optional_ parameter and defaults to `-1` which is global scope. +- `layers = <0 1...>` will allow limiting a combo to specific layers. This is an _optional_ parameter, when omitted it defaults to global scope. - `bindings` is the behavior that is activated when the behavior is pressed. - (advanced) you can specify `slow-release` if you want the combo binding to be released when all key-positions are released. The default is to release the combo as soon as any of the keys in the combo is released.