refactor(behaviors)!: Remove labels from behaviors

Removed the label property from built-in behaviors, custom behaviors
defined in a few keymaps, and macros generated with ZMK_MACRO().

Now that node names are used to identify behaviors, and names only need
to be unique within the set of behaviors, the names of all behaviors
have been shortened to be similar to their original labels.

This means that any keymaps which reference behavior nodes by name
instead of by label will need to be updated. Keymaps typically use the
labels though, so most keymaps should be unaffected by this change.
This commit is contained in:
Joel Spadin
2023-11-18 00:47:01 -06:00
parent 36eda571b7
commit 23ecf08119
32 changed files with 54 additions and 91 deletions

View File

@@ -6,9 +6,9 @@
/ {
behaviors {
/omit-if-no-ref/ bl: behavior_backlight {
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
/omit-if-no-ref/ bl: bcklight {
compatible = "zmk,behavior-backlight";
label = "BCKLGHT";
#binding-cells = <2>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ bt: behavior_bluetooth {
/omit-if-no-ref/ bt: bluetooth {
compatible = "zmk,behavior-bluetooth";
label = "BLUETOOTH";
#binding-cells = <2>;
};
};

View File

@@ -8,9 +8,8 @@
/ {
behaviors {
/omit-if-no-ref/ caps_word: behavior_caps_word {
/omit-if-no-ref/ caps_word: caps_word {
compatible = "zmk,behavior-caps-word";
label = "CAPS_WORD";
#binding-cells = <0>;
continue-list = <UNDERSCORE BACKSPACE DELETE>;
};

View File

@@ -6,9 +6,9 @@
/ {
behaviors {
ext_power: behavior_ext_power {
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
ext_power: extpower {
compatible = "zmk,behavior-ext-power";
label = "EXTPOWER";
#binding-cells = <1>;
};
};

View File

@@ -10,7 +10,6 @@
behaviors {
/omit-if-no-ref/ gresc: grave_escape {
compatible = "zmk,behavior-mod-morph";
label = "GRAVE_ESCAPE";
#binding-cells = <0>;
bindings = <&kp ESC>, <&kp GRAVE>;
mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>;

View File

@@ -7,9 +7,8 @@
/ {
behaviors {
/* DEPRECATED: `cp` will be removed in the future */
/omit-if-no-ref/ cp: kp: behavior_key_press {
/omit-if-no-ref/ cp: kp: key_press {
compatible = "zmk,behavior-key-press";
label = "KEY_PRESS";
#binding-cells = <1>;
};
};

View File

@@ -8,9 +8,8 @@
/ {
behaviors {
/omit-if-no-ref/ key_repeat: behavior_key_repeat {
/omit-if-no-ref/ key_repeat: key_repeat {
compatible = "zmk,behavior-key-repeat";
label = "KEY_REPEAT";
#binding-cells = <0>;
usage-pages = <HID_USAGE_KEY>;
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ kt: behavior_key_toggle {
/omit-if-no-ref/ kt: key_toggle {
compatible = "zmk,behavior-key-toggle";
label = "KEY_TOGGLE";
#binding-cells = <1>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ lt: behavior_layer_tap {
/omit-if-no-ref/ lt: layer_tap {
compatible = "zmk,behavior-hold-tap";
label = "LAYER_TAP";
#binding-cells = <2>;
flavor = "tap-preferred";
tapping-term-ms = <200>;

View File

@@ -5,10 +5,8 @@
*/
#define MACRO_PLACEHOLDER 0
#define ZMK_MACRO_STRINGIFY(x) #x
#define ZMK_MACRO(name,...) \
name: name { \
label = ZMK_MACRO_STRINGIFY(ZM_ ## name); \
compatible = "zmk,behavior-macro"; \
#binding-cells = <0>; \
__VA_ARGS__ \
@@ -16,7 +14,6 @@ name: name { \
#define ZMK_MACRO1(name,...) \
name: name { \
label = ZMK_MACRO_STRINGIFY(ZM_ ## name); \
compatible = "zmk,behavior-macro-one-param"; \
#binding-cells = <1>; \
__VA_ARGS__ \
@@ -24,7 +21,6 @@ name: name { \
#define ZMK_MACRO2(name,...) \
name: name { \
label = ZMK_MACRO_STRINGIFY(ZM_ ## name); \
compatible = "zmk,behavior-macro-two-param"; \
#binding-cells = <2>; \
__VA_ARGS__ \
@@ -32,63 +28,53 @@ name: name { \
/ {
behaviors {
macro_tap: macro_control_mode_tap {
macro_tap: macro_tap {
compatible = "zmk,macro-control-mode-tap";
label = "MAC_TAP";
#binding-cells = <0>;
};
macro_press: macro_control_mode_press {
macro_press: macro_press {
compatible = "zmk,macro-control-mode-press";
label = "MAC_PRESS";
#binding-cells = <0>;
};
macro_release: macro_control_mode_release {
macro_release: macro_release {
compatible = "zmk,macro-control-mode-release";
label = "MAC_REL";
#binding-cells = <0>;
};
macro_tap_time: macro_control_tap_time {
macro_tap_time: macro_tap_time {
compatible = "zmk,macro-control-tap-time";
label = "MAC_TAP_TIME";
#binding-cells = <1>;
};
macro_wait_time: macro_control_wait_time {
macro_wait_time: macro_wait_time {
compatible = "zmk,macro-control-wait-time";
label = "MAC_WAIT_TIME";
#binding-cells = <1>;
};
macro_pause_for_release: macro_pause_for_release {
compatible = "zmk,macro-pause-for-release";
label = "MAC_WAIT_REL";
#binding-cells = <0>;
};
macro_param_1to1: macro_param_1to1 {
compatible = "zmk,macro-param-1to1";
label = "MAC_PARAM_1TO1";
#binding-cells = <0>;
};
macro_param_1to2: macro_param_1to2 {
compatible = "zmk,macro-param-1to2";
label = "MAC_PARAM_1TO2";
#binding-cells = <0>;
};
macro_param_2to1: macro_param_2to1 {
compatible = "zmk,macro-param-2to1";
label = "MAC_PARAM_2TO1";
#binding-cells = <0>;
};
macro_param_2to2: macro_param_2to2 {
compatible = "zmk,macro-param-2to2";
label = "MAC_PARAM_2TO2";
#binding-cells = <0>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ mt: behavior_mod_tap {
/omit-if-no-ref/ mt: mod_tap {
compatible = "zmk,behavior-hold-tap";
label = "MOD_TAP";
#binding-cells = <2>;
flavor = "hold-preferred";
tapping-term-ms = <200>;

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ mo: behavior_momentary_layer {
/omit-if-no-ref/ mo: momentary_layer {
compatible = "zmk,behavior-momentary-layer";
label = "MO";
#binding-cells = <1>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ none: behavior_none {
/omit-if-no-ref/ none: none {
compatible = "zmk,behavior-none";
label = "NONE";
#binding-cells = <0>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ out: behavior_outputs {
/omit-if-no-ref/ out: outputs {
compatible = "zmk,behavior-outputs";
label = "OUTPUTS";
#binding-cells = <1>;
};
};

View File

@@ -8,15 +8,15 @@
/ {
behaviors {
sys_reset: behavior_reset {
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
sys_reset: sysreset {
compatible = "zmk,behavior-reset";
label = "SYSRESET";
#binding-cells = <0>;
};
bootloader: behavior_reset_dfu {
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
bootloader: bootload {
compatible = "zmk,behavior-reset";
label = "BOOTLOAD";
type = <RST_UF2>;
#binding-cells = <0>;
};

View File

@@ -6,9 +6,9 @@
/ {
behaviors {
rgb_ug: behavior_rgb_underglow {
// Behavior can be invoked on peripherals, so name must be <= 8 characters.
rgb_ug: rgb_ug {
compatible = "zmk,behavior-rgb-underglow";
label = "RGB_UG";
#binding-cells = <2>;
};
};

View File

@@ -7,9 +7,8 @@
/ {
behaviors {
/* DEPRECATED: `inc_dec_cp` will be removed in the future */
/omit-if-no-ref/ inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
/omit-if-no-ref/ inc_dec_cp: inc_dec_kp: enc_key_press {
compatible = "zmk,behavior-sensor-rotate-var";
label = "ENC_KEY_PRESS";
#sensor-binding-cells = <2>;
bindings = <&kp>, <&kp>;
};

View File

@@ -6,17 +6,15 @@
/ {
behaviors {
/omit-if-no-ref/ sk: behavior_sticky_key {
/omit-if-no-ref/ sk: sticky_key {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_KEY";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&kp>;
ignore-modifiers;
};
/omit-if-no-ref/ sl: behavior_sticky_layer {
/omit-if-no-ref/ sl: sticky_layer {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_LAYER";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&mo>;

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ to: behavior_to_layer {
/omit-if-no-ref/ to: to_layer {
compatible = "zmk,behavior-to-layer";
label = "TO_LAYER";
#binding-cells = <1>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ tog: behavior_toggle_layer {
/omit-if-no-ref/ tog: toggle_layer {
compatible = "zmk,behavior-toggle-layer";
label = "TOGGLE_LAYER";
#binding-cells = <1>;
};
};

View File

@@ -6,9 +6,8 @@
/ {
behaviors {
/omit-if-no-ref/ trans: behavior_transparent {
/omit-if-no-ref/ trans: transparent {
compatible = "zmk,behavior-transparent";
label = "TRANS";
#binding-cells = <0>;
};
};