feat(behaviors): Add behavior metadata information.

* For upcoming ZMK studio work, make a set of rich metadata available
  to provide a friendly name for a behavior, and allow super flexible
  descriptions of the parameters the behaviors take.
* Add ability to validate a zmk_behavior_binding against
  the behavior metadata available.
This commit is contained in:
Peter Johanson
2024-03-27 12:27:49 -07:00
committed by Pete Johanson
parent 7cdf1e42ea
commit 03099b04b6
42 changed files with 965 additions and 14 deletions

View File

@@ -10,6 +10,7 @@
/omit-if-no-ref/ bl: bcklight {
compatible = "zmk,behavior-backlight";
#binding-cells = <2>;
display-name = "Backlight";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ bt: bluetooth {
compatible = "zmk,behavior-bluetooth";
#binding-cells = <2>;
display-name = "Bluetooth";
};
};
};

View File

@@ -12,6 +12,7 @@
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
continue-list = <UNDERSCORE BACKSPACE DELETE>;
display-name = "Caps Word";
};
};
};

View File

@@ -10,6 +10,7 @@
ext_power: extpower {
compatible = "zmk,behavior-ext-power";
#binding-cells = <1>;
display-name = "External Power";
};
};
};

View File

@@ -13,6 +13,7 @@
#binding-cells = <0>;
bindings = <&kp ESC>, <&kp GRAVE>;
mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>;
display-name = "Grave/Escape";
};
};
};

View File

@@ -10,6 +10,7 @@
/omit-if-no-ref/ cp: kp: key_press {
compatible = "zmk,behavior-key-press";
#binding-cells = <1>;
display-name = "Key Press";
};
};
};

View File

@@ -12,6 +12,7 @@
compatible = "zmk,behavior-key-repeat";
#binding-cells = <0>;
usage-pages = <HID_USAGE_KEY>;
display-name = "Key Repeat";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ kt: key_toggle {
compatible = "zmk,behavior-key-toggle";
#binding-cells = <1>;
display-name = "Key Toggle";
};
};
};

View File

@@ -12,6 +12,7 @@
flavor = "tap-preferred";
tapping-term-ms = <200>;
bindings = <&mo>, <&kp>;
display-name = "Layer-Tap";
};
};
};

View File

@@ -12,6 +12,7 @@
flavor = "hold-preferred";
tapping-term-ms = <200>;
bindings = <&kp>, <&kp>;
display-name = "Mod-Tap";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ mo: momentary_layer {
compatible = "zmk,behavior-momentary-layer";
#binding-cells = <1>;
display-name = "Momentary Layer";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ none: none {
compatible = "zmk,behavior-none";
#binding-cells = <0>;
display-name = "None";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ out: outputs {
compatible = "zmk,behavior-outputs";
#binding-cells = <1>;
display-name = "Output Selection";
};
};
};

View File

@@ -12,6 +12,7 @@
sys_reset: sysreset {
compatible = "zmk,behavior-reset";
#binding-cells = <0>;
display-name = "Reset";
};
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
@@ -19,6 +20,7 @@
compatible = "zmk,behavior-reset";
type = <RST_UF2>;
#binding-cells = <0>;
display-name = "Bootloader";
};
};
};

View File

@@ -10,6 +10,7 @@
rgb_ug: rgb_ug {
compatible = "zmk,behavior-rgb-underglow";
#binding-cells = <2>;
display-name = "Underglow";
};
};
};

View File

@@ -12,6 +12,7 @@
release-after-ms = <1000>;
bindings = <&kp>;
ignore-modifiers;
display-name = "Sticky Key";
};
/omit-if-no-ref/ sl: sticky_layer {
compatible = "zmk,behavior-sticky-key";
@@ -19,6 +20,7 @@
release-after-ms = <1000>;
bindings = <&mo>;
quick-release;
display-name = "Sticky Layer";
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ to: to_layer {
compatible = "zmk,behavior-to-layer";
#binding-cells = <1>;
display-name = "To Layer";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ tog: toggle_layer {
compatible = "zmk,behavior-toggle-layer";
#binding-cells = <1>;
display-name = "Toggle Layer";
};
};
};

View File

@@ -9,6 +9,7 @@
/omit-if-no-ref/ trans: transparent {
compatible = "zmk,behavior-transparent";
#binding-cells = <0>;
display-name = "Transparent";
};
};
};

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
properties:
display-name:
type: string

View File

@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: behavior-metadata.yaml
properties:
label:
type: string

View File

@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: behavior-metadata.yaml
properties:
label:
type: string

View File

@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: behavior-metadata.yaml
properties:
label:
type: string