From 0977be622a6ae2c61231f89b888c3e77f89bd477 Mon Sep 17 00:00:00 2001 From: Caleb Goates Date: Mon, 2 May 2022 21:47:50 -0600 Subject: [PATCH] feat(docs): Add docs for key toggle behavior --- docs/docs/behaviors/key-toggle.md | 26 ++++++++++++++++++++++++++ docs/sidebars.js | 1 + 2 files changed, 27 insertions(+) create mode 100644 docs/docs/behaviors/key-toggle.md diff --git a/docs/docs/behaviors/key-toggle.md b/docs/docs/behaviors/key-toggle.md new file mode 100644 index 00000000..85b328f8 --- /dev/null +++ b/docs/docs/behaviors/key-toggle.md @@ -0,0 +1,26 @@ +--- +title: Key Toggle Behavior +sidebar_label: Key Toggle +--- + +## Summary + +The key toggle behavior toggles the press of a key. +If the key is not currently pressed, key toggle will press it, holding it until the key toggle is pressed again or the key is released in some other way. +If the key _is_ currently pressed, key toggle will release it. + +Example uses for key toggle include shift lock, or `ALT-TAB` window switching without holding down the `ALT` modifier. + +### Behavior Binding + +- Reference: `&kt` +- Parameter: The [keycode](../codes/index.mdx), e.g. `LALT` or `DOWN_ARROW` + +Example: + +``` +&kt LALT +``` + +You can use any keycode that works for `&kp` as parameter to `&kt`, however, [modified keys](../codes/modifiers.mdx#modifier-functions) such as `LA(A)` will be toggled based on the status of the base keycode (in this case `A`). +In other words, modifiers are ignored when determining whether or not the key is currently pressed. diff --git a/docs/sidebars.js b/docs/sidebars.js index ab159689..e7d05850 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -28,6 +28,7 @@ module.exports = { "behaviors/mod-tap", "behaviors/mod-morph", "behaviors/macros", + "behaviors/key-toggle", "behaviors/sticky-key", "behaviors/sticky-layer", "behaviors/tap-dance",