Browse Source

docs(codes): add modifier functions

Refactor and expand codes documentation to include modifier functions.

Closes #330.
xmkb
Okke Formsma 4 years ago committed by Pete Johanson
parent
commit
0d02441abe
  1. 2
      docs/docs/codes/_keyboard-keypad.mdx
  2. 42
      docs/docs/codes/modifiers.mdx
  3. 4
      docs/docs/dev-guide-new-shield.md
  4. 8
      docs/docs/feature/keymaps.md
  5. 1
      docs/sidebars.js
  6. 14
      docs/src/data/hid.js

2
docs/docs/codes/_keyboard-keypad.mdx

@ -24,6 +24,8 @@ import Table from "@site/src/components/codes/Table";
### Modifiers ### Modifiers
The [Modifiers](./modifiers) page includes further information.
<Table group="keyboard-modifiers" /> <Table group="keyboard-modifiers" />
### Locks ### Locks

42
docs/docs/codes/modifiers.mdx

@ -0,0 +1,42 @@
---
title: Modifiers
sidebar_label: Modifiers
hide_title: true
---
import OsLegend from "@site/src/components/codes/OsLegend";
import ToastyContainer from "@site/src/components/codes/ToastyContainer";
import Table from "@site/src/components/codes/Table";
<OsLegend />
<ToastyContainer />
## Modifiers
Modifiers are the special keyboard keys: _shift_, _alt_, _control_ & _GUI_.
Modifiers can be used in two forms within ZMK:
- Modifier [Keys](#modifier-keys) → `LEFT_SHIFT`
- Modifier [Functions](#modifier-functions) → `LS(code)`
<Table group="keyboard-modifiers" />
### Modifier Keys
These act like any other key code.
- e.g. `&kp LEFT_GUI` pushes and releases the left GUI key.
### Modifier Functions
These functions take the form: `XX(code)`
- They _apply_ the modifier to another _code_.
- e.g. `&kp LS(A)` = `LEFT_SHIFT`+`A`
- aka a _shifted_ (capitalized) **A**.
- The _code_ and the _modifier_ are handled _as one_.
- They can be _combined_:
- e.g. `&kp LC(RA(B))` = `LEFT_CONTROL`+`RIGHT_ALT`+`B`
- Some codes _include_ modifiers in their definition.
- e.g. `DOLLAR` = `LS(N4)`

4
docs/docs/dev-guide-new-shield.md

@ -368,12 +368,12 @@ Here is an example simple keymap for the Kyria, with only one layer:
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------------
// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | // | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ |
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | // | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | R CTRL | // | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL |
// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT | // | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT |
bindings = < bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LSHFT &kp LSHFT &kp LSHFT &kp LSHFT &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL
&kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT &kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT
>; >;

8
docs/docs/feature/keymaps.md

@ -130,12 +130,12 @@ that defines just one layer for this keymap:
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------------
// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | // | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ |
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | // | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | R CTRL | // | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL |
// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT | // | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT |
bindings = < bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LSHFT &kp LSHFT &kp LSHFT &kp LSHFT &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL
&kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT &kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT
>; >;
@ -167,12 +167,12 @@ Putting this all together, a complete [`kyria.keymap`](https://github.com/zmkfir
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------------
// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | // | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ |
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | // | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | R CTRL | // | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL |
// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT | // | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT |
bindings = < bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp QUOTE
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LSHFT &kp LSHFT &kp LSHFT &kp LSHFT &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL
&kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT &kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT
>; >;

1
docs/sidebars.js

@ -29,6 +29,7 @@ module.exports = {
Codes: [ Codes: [
"codes/index", "codes/index",
"codes/keyboard-keypad", "codes/keyboard-keypad",
"codes/modifiers",
"codes/editing", "codes/editing",
"codes/media", "codes/media",
"codes/applications", "codes/applications",

14
docs/src/data/hid.js

@ -4059,7 +4059,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["LEFT_CONTROL", "LCTRL"], names: ["LEFT_CONTROL", "LCTRL", "LC(code)"],
description: "Left Control", description: "Left Control",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4080,7 +4080,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["LEFT_SHIFT", "LSHFT"], names: ["LEFT_SHIFT", "LSHFT", "LS(code)"],
description: "Left Shift ⇧", description: "Left Shift ⇧",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4101,7 +4101,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["LEFT_ALT", "LALT"], names: ["LEFT_ALT", "LALT", "LA(code)"],
description: "Left Alt", description: "Left Alt",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4125,6 +4125,7 @@ export default [
names: [ names: [
"LEFT_GUI", "LEFT_GUI",
"LGUI", "LGUI",
"LG(code)",
"LEFT_WIN", "LEFT_WIN",
"LWIN", "LWIN",
"LEFT_COMMAND", "LEFT_COMMAND",
@ -4152,7 +4153,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["RIGHT_CONTROL", "RCTRL"], names: ["RIGHT_CONTROL", "RCTRL", "RC(code)"],
description: "Right Control", description: "Right Control",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4173,7 +4174,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["RIGHT_SHIFT", "RSHFT"], names: ["RIGHT_SHIFT", "RSHFT", "RS(code)"],
description: "Right Shift ⇧", description: "Right Shift ⇧",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4194,7 +4195,7 @@ export default [
footnotes: {}, footnotes: {},
}, },
{ {
names: ["RIGHT_ALT", "RALT"], names: ["RIGHT_ALT", "RALT", "RA(code)"],
description: "Right Alt", description: "Right Alt",
context: "Keyboard", context: "Keyboard",
clarify: false, clarify: false,
@ -4218,6 +4219,7 @@ export default [
names: [ names: [
"RIGHT_GUI", "RIGHT_GUI",
"RGUI", "RGUI",
"RG(code)",
"RIGHT_WIN", "RIGHT_WIN",
"RWIN", "RWIN",
"RIGHT_COMMAND", "RIGHT_COMMAND",

Loading…
Cancel
Save