feat: Added toggle-mode, allowing toggle-on and toggle-off (#2555)

feat: added toggle mode to key and layer toggles

docs: documented toggle mode changes
This commit is contained in:
Nicolas Munnich
2024-12-13 00:13:56 +00:00
committed by GitHub
parent 7013158a67
commit 4ef231f4bb
23 changed files with 346 additions and 16 deletions

View File

@@ -103,6 +103,28 @@ Example:
&tog 3
```
### Configuration
#### Toggle mode
If you wish to ensure that a layer is toggled on or off specifically, rather than switching between the two states, then you can do so with the `toggle-mode` property.
Define a new behavior and assign `"on"` or `"off"` to `toggle-mode`:
```dts
/ {
behaviors {
tog_on: toggle_layer_on_only {
compatible = "zmk,behavior-toggle-layer";
#binding-cells = <1>;
display-name = "Toggle Layer On";
toggle-mode = "on";
};
};
};
```
You can then use `&tog_on` in place of `&tog` whenever you wish to only toggle a layer on, and not toggle it off. An `"off"` version of the behavior can be defined similarly.
## Conditional Layers
The "conditional layers" feature enables a particular layer when all layers in a specified set are active.