Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(behaviors): Add behavior metadata information. #2231

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/Kconfig.behaviors
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

config ZMK_BEHAVIOR_METADATA
bool "Metadata"
help
Enabling this option adds APIs for documenting and fetching
metadata describing a behaviors name, and supported parameters.

config ZMK_BEHAVIOR_KEY_TOGGLE
bool
default y
Expand Down Expand Up @@ -35,4 +41,4 @@ config ZMK_BEHAVIOR_SENSOR_ROTATE_VAR
config ZMK_BEHAVIOR_MACRO
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_MACRO_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_ONE_PARAM_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_TWO_PARAM_ENABLED
depends on DT_HAS_ZMK_BEHAVIOR_MACRO_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_ONE_PARAM_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_TWO_PARAM_ENABLED
1 change: 1 addition & 0 deletions app/dts/behaviors/backlight.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/omit-if-no-ref/ bl: bcklight {
compatible = "zmk,behavior-backlight";
#binding-cells = <2>;
display-name = "Backlight";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/bluetooth.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ bt: bluetooth {
compatible = "zmk,behavior-bluetooth";
#binding-cells = <2>;
display-name = "Bluetooth";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/caps_word.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
continue-list = <UNDERSCORE BACKSPACE DELETE>;
display-name = "Caps Word";
};
};
};
Expand Down
1 change: 1 addition & 0 deletions app/dts/behaviors/ext_power.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ext_power: extpower {
compatible = "zmk,behavior-ext-power";
#binding-cells = <1>;
display-name = "External Power";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/gresc.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/key_press.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/omit-if-no-ref/ cp: kp: key_press {
compatible = "zmk,behavior-key-press";
#binding-cells = <1>;
display-name = "Key Press";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/key_repeat.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
compatible = "zmk,behavior-key-repeat";
#binding-cells = <0>;
usage-pages = <HID_USAGE_KEY>;
display-name = "Key Repeat";
};
};
};
Expand Down
1 change: 1 addition & 0 deletions app/dts/behaviors/key_toggle.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ kt: key_toggle {
compatible = "zmk,behavior-key-toggle";
#binding-cells = <1>;
display-name = "Key Toggle";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/layer_tap.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
flavor = "tap-preferred";
tapping-term-ms = <200>;
bindings = <&mo>, <&kp>;
display-name = "Layer-Tap";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/mod_tap.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
flavor = "hold-preferred";
tapping-term-ms = <200>;
bindings = <&kp>, <&kp>;
display-name = "Mod-Tap";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/momentary_layer.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ mo: momentary_layer {
compatible = "zmk,behavior-momentary-layer";
#binding-cells = <1>;
display-name = "Momentary Layer";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/none.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ none: none {
compatible = "zmk,behavior-none";
#binding-cells = <0>;
display-name = "None";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/outputs.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ out: outputs {
compatible = "zmk,behavior-outputs";
#binding-cells = <1>;
display-name = "Output Selection";
};
};
};
2 changes: 2 additions & 0 deletions app/dts/behaviors/reset.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
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.
bootloader: bootload {
compatible = "zmk,behavior-reset";
type = <RST_UF2>;
#binding-cells = <0>;
display-name = "Bootloader";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/rgb_underglow.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
rgb_ug: rgb_ug {
compatible = "zmk,behavior-rgb-underglow";
#binding-cells = <2>;
display-name = "Underglow";
};
};
};
2 changes: 2 additions & 0 deletions app/dts/behaviors/sticky_key.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
release-after-ms = <1000>;
bindings = <&kp>;
ignore-modifiers;
display-name = "Sticky Key";
};
/omit-if-no-ref/ sl: sticky_layer {
compatible = "zmk,behavior-sticky-key";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&mo>;
quick-release;
display-name = "Sticky Layer";
};
};

Expand Down
1 change: 1 addition & 0 deletions app/dts/behaviors/to_layer.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ to: to_layer {
compatible = "zmk,behavior-to-layer";
#binding-cells = <1>;
display-name = "To Layer";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/toggle_layer.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ tog: toggle_layer {
compatible = "zmk,behavior-toggle-layer";
#binding-cells = <1>;
display-name = "Toggle Layer";
};
};
};
1 change: 1 addition & 0 deletions app/dts/behaviors/transparent.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/omit-if-no-ref/ trans: transparent {
compatible = "zmk,behavior-transparent";
#binding-cells = <0>;
display-name = "Transparent";
};
};
};
6 changes: 6 additions & 0 deletions app/dts/bindings/behaviors/behavior-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

properties:
display-name:
type: string
2 changes: 2 additions & 0 deletions app/dts/bindings/behaviors/one_param.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

include: behavior-metadata.yaml

properties:
label:
type: string
Expand Down
2 changes: 2 additions & 0 deletions app/dts/bindings/behaviors/two_param.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

include: behavior-metadata.yaml

properties:
label:
type: string
Expand Down
2 changes: 2 additions & 0 deletions app/dts/bindings/behaviors/zero_param.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

include: behavior-metadata.yaml

properties:
label:
type: string
Expand Down
Loading
Loading