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:
parent
7cdf1e42ea
commit
03099b04b6
42 changed files with 965 additions and 14 deletions
|
|
@ -10,6 +10,7 @@
|
|||
/omit-if-no-ref/ bl: bcklight {
|
||||
compatible = "zmk,behavior-backlight";
|
||||
#binding-cells = <2>;
|
||||
display-name = "Backlight";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ bt: bluetooth {
|
||||
compatible = "zmk,behavior-bluetooth";
|
||||
#binding-cells = <2>;
|
||||
display-name = "Bluetooth";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
compatible = "zmk,behavior-caps-word";
|
||||
#binding-cells = <0>;
|
||||
continue-list = <UNDERSCORE BACKSPACE DELETE>;
|
||||
display-name = "Caps Word";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
ext_power: extpower {
|
||||
compatible = "zmk,behavior-ext-power";
|
||||
#binding-cells = <1>;
|
||||
display-name = "External Power";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
/omit-if-no-ref/ cp: kp: key_press {
|
||||
compatible = "zmk,behavior-key-press";
|
||||
#binding-cells = <1>;
|
||||
display-name = "Key Press";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
compatible = "zmk,behavior-key-repeat";
|
||||
#binding-cells = <0>;
|
||||
usage-pages = <HID_USAGE_KEY>;
|
||||
display-name = "Key Repeat";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ kt: key_toggle {
|
||||
compatible = "zmk,behavior-key-toggle";
|
||||
#binding-cells = <1>;
|
||||
display-name = "Key Toggle";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
flavor = "tap-preferred";
|
||||
tapping-term-ms = <200>;
|
||||
bindings = <&mo>, <&kp>;
|
||||
display-name = "Layer-Tap";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
flavor = "hold-preferred";
|
||||
tapping-term-ms = <200>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
display-name = "Mod-Tap";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ mo: momentary_layer {
|
||||
compatible = "zmk,behavior-momentary-layer";
|
||||
#binding-cells = <1>;
|
||||
display-name = "Momentary Layer";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ none: none {
|
||||
compatible = "zmk,behavior-none";
|
||||
#binding-cells = <0>;
|
||||
display-name = "None";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ out: outputs {
|
||||
compatible = "zmk,behavior-outputs";
|
||||
#binding-cells = <1>;
|
||||
display-name = "Output Selection";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
rgb_ug: rgb_ug {
|
||||
compatible = "zmk,behavior-rgb-underglow";
|
||||
#binding-cells = <2>;
|
||||
display-name = "Underglow";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ to: to_layer {
|
||||
compatible = "zmk,behavior-to-layer";
|
||||
#binding-cells = <1>;
|
||||
display-name = "To Layer";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ tog: toggle_layer {
|
||||
compatible = "zmk,behavior-toggle-layer";
|
||||
#binding-cells = <1>;
|
||||
display-name = "Toggle Layer";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
/omit-if-no-ref/ trans: transparent {
|
||||
compatible = "zmk,behavior-transparent";
|
||||
#binding-cells = <0>;
|
||||
display-name = "Transparent";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
6
app/dts/bindings/behaviors/behavior-metadata.yaml
Normal file
6
app/dts/bindings/behaviors/behavior-metadata.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2024 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
properties:
|
||||
display-name:
|
||||
type: string
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
include: behavior-metadata.yaml
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
include: behavior-metadata.yaml
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
include: behavior-metadata.yaml
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue