From af9d6e9b0551f735382ce6576b33e29a86329fa3 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 6 Feb 2021 21:47:21 +0100 Subject: [PATCH] style(hold-tap)!: Write hold-tap params with dashes tapping_term_ms -> tapping-term-ms quick_tap_ms -> quick-tap-ms The old style works, although it's deprecated. --- app/boards/shields/qaz/qaz.keymap | 2 +- app/boards/shields/tg4x/tg4x.keymap | 2 +- app/dts/behaviors/layer_tap.dtsi | 2 +- app/dts/behaviors/mod_tap.dtsi | 2 +- .../bindings/behaviors/zmk,behavior-hold-tap.yaml | 8 ++++++-- app/src/behaviors/behavior_hold_tap.c | 1 - app/tests/hold-tap/balanced/behavior_keymap.dtsi | 4 ++-- .../balanced/many-nested/native_posix.keymap | 2 +- .../hold-tap/hold-preferred/behavior_keymap.dtsi | 4 ++-- .../hold-tap/tap-preferred/behavior_keymap.dtsi | 4 ++-- docs/docs/behaviors/hold-tap.md | 12 ++++++------ docs/docs/behaviors/mod-tap.md | 4 ++-- 12 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/boards/shields/qaz/qaz.keymap b/app/boards/shields/qaz/qaz.keymap index 8ac61f61..a832860e 100644 --- a/app/boards/shields/qaz/qaz.keymap +++ b/app/boards/shields/qaz/qaz.keymap @@ -18,7 +18,7 @@ compatible = "zmk,behavior-hold-tap"; label = "homerow mods"; #binding-cells = <2>; - tapping_term_ms = <225>; + tapping-term-ms = <225>; flavor = "tap-preferred"; bindings = <&kp>, <&kp>; }; diff --git a/app/boards/shields/tg4x/tg4x.keymap b/app/boards/shields/tg4x/tg4x.keymap index d5e20094..84ca3273 100644 --- a/app/boards/shields/tg4x/tg4x.keymap +++ b/app/boards/shields/tg4x/tg4x.keymap @@ -14,7 +14,7 @@ compatible = "zmk,behavior-hold-tap"; label = "Hold Tap"; #binding-cells = <2>; - tapping_term_ms = <200>; + tapping-term-ms = <200>; flavor = "tap-preferred"; bindings = <&kp>, <&kp>; }; diff --git a/app/dts/behaviors/layer_tap.dtsi b/app/dts/behaviors/layer_tap.dtsi index b4539b35..21fd9d56 100644 --- a/app/dts/behaviors/layer_tap.dtsi +++ b/app/dts/behaviors/layer_tap.dtsi @@ -11,7 +11,7 @@ label = "LAYER_TAP"; #binding-cells = <2>; flavor = "tap-preferred"; - tapping_term_ms = <200>; + tapping-term-ms = <200>; bindings = <&mo>, <&kp>; }; }; diff --git a/app/dts/behaviors/mod_tap.dtsi b/app/dts/behaviors/mod_tap.dtsi index 79ce10c2..7a98713c 100644 --- a/app/dts/behaviors/mod_tap.dtsi +++ b/app/dts/behaviors/mod_tap.dtsi @@ -11,7 +11,7 @@ label = "MOD_TAP"; #binding-cells = <2>; flavor = "hold-preferred"; - tapping_term_ms = <200>; + tapping-term-ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml index 56f0cc27..50fa5d50 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml @@ -11,11 +11,15 @@ properties: bindings: type: phandles required: true - tapping_term_ms: + tapping-term-ms: type: int - quick_tap_ms: + tapping_term_ms: # deprecated + type: int + quick-tap-ms: type: int default: -1 + quick_tap_ms: # deprecated + type: int flavor: type: string required: false diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index a7185fb0..ab25c3cd 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -47,7 +47,6 @@ struct behavior_hold_tap_config { // this data is specific for each hold-tap struct active_hold_tap { int32_t position; - // todo: move these params into the config->behaviors->tap and uint32_t param_hold; uint32_t param_tap; int64_t timestamp; diff --git a/app/tests/hold-tap/balanced/behavior_keymap.dtsi b/app/tests/hold-tap/balanced/behavior_keymap.dtsi index 972b606f..d62be888 100644 --- a/app/tests/hold-tap/balanced/behavior_keymap.dtsi +++ b/app/tests/hold-tap/balanced/behavior_keymap.dtsi @@ -9,8 +9,8 @@ label = "HOLD_TAP_BALANCED"; #binding-cells = <2>; flavor = "balanced"; - tapping_term_ms = <300>; - quick_tap_ms = <200>; + tapping-term-ms = <300>; + quick-tap-ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/tests/hold-tap/balanced/many-nested/native_posix.keymap b/app/tests/hold-tap/balanced/many-nested/native_posix.keymap index 7941e4d3..2698f055 100644 --- a/app/tests/hold-tap/balanced/many-nested/native_posix.keymap +++ b/app/tests/hold-tap/balanced/many-nested/native_posix.keymap @@ -9,7 +9,7 @@ label = "HOLD_TAP_BALANCED"; #binding-cells = <2>; flavor = "balanced"; - tapping_term_ms = <300>; + tapping-term-ms = <300>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi index 2b35f890..41c84e1e 100644 --- a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi @@ -11,8 +11,8 @@ label = "hold_hold_tap"; #binding-cells = <2>; flavor = "hold-preferred"; - tapping_term_ms = <300>; - quick_tap_ms = <200>; + tapping-term-ms = <300>; + quick-tap-ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi index 80d6b0af..cdeb9596 100644 --- a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi @@ -9,8 +9,8 @@ label = "MOD_TAP"; #binding-cells = <2>; flavor = "tap-preferred"; - tapping_term_ms = <300>; - quick_tap_ms = <200>; + tapping-term-ms = <300>; + quick-tap-ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index c148fa37..13261140 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -23,9 +23,9 @@ We call this the 'hold-preferred' flavor of hold-taps. While this flavor may wor #### Flavors -- The 'hold-preferred' flavor triggers the hold behavior when the `tapping_term_ms` has expired or another key is pressed. -- The 'balanced' flavor will trigger the hold behavior when the `tapping_term_ms` has expired or another key is pressed and released. -- The 'tap-preferred' flavor triggers the hold behavior when the `tapping_term_ms` has expired. It triggers the tap behavior when another key is pressed. +- The 'hold-preferred' flavor triggers the hold behavior when the `tapping-term-ms` has expired or another key is pressed. +- The 'balanced' flavor will trigger the hold behavior when the `tapping-term-ms` has expired or another key is pressed and released. +- The 'tap-preferred' flavor triggers the hold behavior when the `tapping-term-ms` has expired. It triggers the tap behavior when another key is pressed. When the hold-tap key is released and the hold behavior has not been triggered, the tap behavior will trigger. @@ -37,7 +37,7 @@ For basic usage, please see [mod-tap](./mod-tap.md) and [layer-tap](./layers.md) ### Advanced Configuration -#### `tapping_term_ms` +#### `tapping-term-ms` Defines how long a key must be pressed to trigger Hold behavior. @@ -61,7 +61,7 @@ This example configures a hold-tap that works well for homerow mods: compatible = "zmk,behavior-hold-tap"; label = "HOMEROW_MODS"; #binding-cells = <2>; - tapping_term_ms = <150>; + tapping-term-ms = <150>; quick_tap_ms = <0>; flavor = "tap-preferred"; bindings = <&kp>, <&kp>; @@ -81,7 +81,7 @@ This example configures a hold-tap that works well for homerow mods: ``` -If this config does not work for you, try the flavor "balanced" with a medium `tapping_term_ms` such as 200ms. +If this config does not work for you, try the flavor "balanced" with a medium `tapping-term-ms` such as 200ms. #### Comparison to QMK diff --git a/docs/docs/behaviors/mod-tap.md b/docs/docs/behaviors/mod-tap.md index 6404a220..bd08a38d 100644 --- a/docs/docs/behaviors/mod-tap.md +++ b/docs/docs/behaviors/mod-tap.md @@ -34,7 +34,7 @@ You can configure a different tapping term in your keymap: ``` &mt { - tapping_term_ms = <400>; + tapping-term-ms = <400>; }; / { @@ -46,4 +46,4 @@ You can configure a different tapping term in your keymap: ### Additional information -The mod-tap is a [hold-tap](./hold-tap.md) under the hood with the "balanced" flavor and tapping_term_ms 200. +The mod-tap is a [hold-tap](./hold-tap.md) under the hood with the "balanced" flavor and tapping-term-ms 200.