From dd8deceed02b9d439eca3bc10fdde5b5d0fb9c6e Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 16:29:52 -0400 Subject: [PATCH] Add basic layer behavior docs. --- docs/docs/behavior/layers.md | 41 ++++++++++++++++++++++++++++++++++++ docs/sidebars.js | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 docs/docs/behavior/layers.md diff --git a/docs/docs/behavior/layers.md b/docs/docs/behavior/layers.md new file mode 100644 index 00000000..2388cafe --- /dev/null +++ b/docs/docs/behavior/layers.md @@ -0,0 +1,41 @@ +--- +title: Layers +--- + +## Summary + +Often, you may want a certain key position to alter which layers are enabled, change the default layer, etc. +Some of those behaviors are still in the works; the ones that are working now are documented here. + +## Defines To Refer To Layers + +When working with layers, you may have several different key positions with bindings that enable/disable those layers. +To make it easier to refer to those layers in your key bindings, and to change which layers are where later, you can +add a set of `#define`s at the top of your keymap file, and use those layer in your keymap. + +For example, if you have three layers, you can add the following to the top of your keymap: + +``` +#define DEFAULT 0 +#define LOWER 1 +#define RAISE 2 +``` + +This allows you to use those defines, e.g. `LOWER` later in your keymap. + +## Momentary Layer + +The "momentary layer" behavior allows you to enable a layer while a certain key is pressed. Immediately upon +activation of the key, the layer is enabled, and immediately open release of the key, the layer is disabled +again. + +### Behavior Binding + +- Reference: `&mo` +- Parameter: The layer number to enable/disable, e.g. `1` + +Example: + +``` +&mo LOWER +``` diff --git a/docs/sidebars.js b/docs/sidebars.js index 43d4ea7c..7b04864a 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -7,7 +7,7 @@ module.exports = { "feature/encoders", "feature/underglow", ], - Behaviors: ["behavior/key-press"], + Behaviors: ["behavior/key-press", "behavior/layers"], Development: [ "dev-clean-room", "dev-setup",