Skip to content

Commit

Permalink
docs: Move defines to the end in layer behaviors (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
Genteure authored Nov 20, 2024
1 parent 33113c7 commit 76ee97e
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions docs/docs/keymaps/behaviors/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,14 @@ sidebar_label: 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.
Below are the list of behaviors that can be used to activate and deactivate layers.

:::note
Multiple layers can be active at the same time and activating a layer will not deactivate layers higher up in the "layer stack". See [Layers](../index.mdx#layers) for more information.
:::

## Defines to Refer to Layers
Multiple layers can be active at the same time and activating a layer will not deactivate layers higher up in the "layer stack".

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:

```dts
#define DEFAULT 0
#define LOWER 1
#define RAISE 2
```

This allows you to use those defines, e.g. `LOWER` later in your keymap.
Layer numbers start at 0 following the order they are defined in the keymap node, for example `&mo 3` would activate the 4th layer node defined in the keymap.
See [Layers](../index.mdx#layers) for more information.
:::

## Momentary Layer

Expand All @@ -42,7 +29,7 @@ again.
Example:

```dts
&mo LOWER
&mo 3
```

## Layer-Tap
Expand All @@ -58,7 +45,7 @@ The "layer-tap" behavior enables a layer when a key is held, and outputs a [keyp
Example:

```dts
&lt LOWER SPACE
&lt 3 SPACE
```

### Configuration
Expand Down Expand Up @@ -113,10 +100,30 @@ The "toggle layer" behavior enables a layer if it is currently disabled, or disa
Example:

```dts
&tog LOWER
&tog 3
```

## Conditional Layers

The "conditional layers" feature enables a particular layer when all layers in a specified set are active.
For more information, see [conditional layers](../conditional-layers.md).

## 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 defines in your keymap.

For example, if you have three layers, you can add the following to the top of your keymap:

```dts
#define DEFAULT 0
#define LOWER 1
#define RAISE 2
```

This allows you to use those defines, e.g. `LOWER` later in your keymap.

```dts
&mo LOWER // equivalent to &mo 1
```

0 comments on commit 76ee97e

Please sign in to comment.