From 67db38efb41cf65014fdc3de0d0f56d2cc8da943 Mon Sep 17 00:00:00 2001 From: "jmding@gmail.com" Date: Mon, 13 Sep 2021 02:20:17 +0000 Subject: [PATCH 1/6] fix NULL typecheck and add documentation note about tapping-term --- app/src/behaviors/behavior_hold_tap.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index b977a970..317be061 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -361,8 +361,10 @@ static int release_binding(struct active_hold_tap *hold_tap) { return behavior_keymap_binding_released(&binding, event); } -static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_moment, - int32_t other_key_down_position) { +static void +decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_moment, + int32_t other_key_down_position // use -1 if decision_moment != HT_OTHER_KEY_DOWN +) { if (hold_tap->status != STATUS_UNDECIDED) { return; } @@ -466,7 +468,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding, undecided_hold_tap = hold_tap; if (is_quick_tap(hold_tap)) { - decide_hold_tap(hold_tap, HT_QUICK_TAP, NULL); + decide_hold_tap(hold_tap, HT_QUICK_TAP, -1); } // if this behavior was queued we have to adjust the timer to only @@ -489,10 +491,10 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding, // We insert a timer event before the TH_KEY_UP event to verify. int work_cancel_result = k_delayed_work_cancel(&hold_tap->work); if (event.timestamp > (hold_tap->timestamp + hold_tap->config->tapping_term_ms)) { - decide_hold_tap(hold_tap, HT_TIMER_EVENT, NULL); + decide_hold_tap(hold_tap, HT_TIMER_EVENT, -1); } - decide_hold_tap(hold_tap, HT_KEY_UP, NULL); + decide_hold_tap(hold_tap, HT_KEY_UP, -1); decide_retro_tap(hold_tap); release_binding(hold_tap); @@ -539,7 +541,7 @@ static int position_state_changed_listener(const zmk_event_t *eh) { // have run out. if (ev->timestamp > (undecided_hold_tap->timestamp + undecided_hold_tap->config->tapping_term_ms)) { - decide_hold_tap(undecided_hold_tap, HT_TIMER_EVENT, NULL); + decide_hold_tap(undecided_hold_tap, HT_TIMER_EVENT, -1); } if (!ev->state && find_captured_keydown_event(ev->position) == NULL) { @@ -554,7 +556,7 @@ static int position_state_changed_listener(const zmk_event_t *eh) { ev->state ? "down" : "up"); capture_event(eh); decide_hold_tap(undecided_hold_tap, ev->state ? HT_OTHER_KEY_DOWN : HT_OTHER_KEY_UP, - ev->state ? ev->position : NULL); + ev->state ? ev->position : -1); return ZMK_EV_EVENT_CAPTURED; } @@ -600,7 +602,7 @@ void behavior_hold_tap_timer_work_handler(struct k_work *item) { if (hold_tap->work_is_cancelled) { clear_hold_tap(hold_tap); } else { - decide_hold_tap(hold_tap, HT_TIMER_EVENT, NULL); + decide_hold_tap(hold_tap, HT_TIMER_EVENT, -1); } } From 3d9a72e1cebf8c5e11994525ce955d24a4044685 Mon Sep 17 00:00:00 2001 From: "jmding@gmail.com" Date: Mon, 13 Sep 2021 02:53:02 +0000 Subject: [PATCH 2/6] add ntoe about tapping term to docs (that was mistakenly left out of the prev commit --- docs/docs/behaviors/hold-tap.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index a9ca5b0b..7c9cfb96 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -135,6 +135,8 @@ Meanwhile, the sequence `(cht_down, E_down, E_up, W_down, W_up cht_up)` produces Conditional hold-taps can be useful with home-row modifiers for example. By setting `hold-enabler-keys` to include only the keys controlled by the opposite hand, conditional hold-taps can prevent one-handed "rolls" from accidentally triggering hold behaviors. +Note that while for regular hold-tap behaviors a shorter `tapping-term` encourages hold decisions, the opposite is true for conditional hold-tap behaviors. For conditional hold-taps, a shorter `tapping-term` actually encourages tap decisions. This is because when the `tapping-term` expires, this triggers the behavior to decide as either a tap or a hold. But if the user has not yet had time to press one of the `hold-enabler-keys`, then the behavior will decide as a tap. Shortening the `tapping-term` thus gives the user less time to press one of the `hold-enabler-keys` to produce a hold behavior. + #### Comparison to QMK The hold-preferred flavor works similar to the `HOLD_ON_OTHER_KEY_PRESS` setting in QMK. The 'balanced' flavor is similar to the `PERMISSIVE_HOLD` setting, and the `tap-preferred` flavor is similar to `IGNORE_MOD_TAP_INTERRUPT`. From b491cb6b4012424875086d6dfb75c3ef0b544184 Mon Sep 17 00:00:00 2001 From: "jmding@gmail.com" Date: Mon, 13 Sep 2021 20:25:09 +0000 Subject: [PATCH 3/6] add more robust testing, balanced only for now --- .../1-dn-up}/events.patterns | 0 .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up}/events.patterns | 0 .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up}/events.patterns | 0 .../keycode_events.snapshot | 8 ++--- .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 6 ++-- .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 17 +++++------ .../1-dn-up/events.patterns | 4 +++ .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up/events.patterns | 4 +++ .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 6 ++-- .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 29 +++++++++++++++++++ .../native_posix.keymap | 14 --------- .../native_posix.keymap | 14 --------- .../native_posix.keymap | 16 ---------- 53 files changed, 389 insertions(+), 64 deletions(-) rename app/tests/hold-tap/{conditional/enabler-other-key-out-of-order => balanced-conditionally-disabled/1-dn-up}/events.patterns (100%) create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap rename app/tests/hold-tap/{conditional/first-other-key-enabled => balanced-conditionally-disabled/2-dn-timer-up}/events.patterns (100%) create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap rename app/tests/hold-tap/{conditional/first-other-key-not-enabled => balanced-conditionally-disabled/3c-kcdn-dn-kcup-up}/events.patterns (100%) rename app/tests/hold-tap/{conditional/first-other-key-not-enabled => balanced-conditionally-disabled/3c-kcdn-dn-kcup-up}/keycode_events.snapshot (63%) create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns rename app/tests/hold-tap/{conditional/enabler-other-key-out-of-order => balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up}/keycode_events.snapshot (86%) create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap rename app/tests/hold-tap/{conditional => balanced-conditionally-disabled}/behavior_keymap.dtsi (62%) create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns rename app/tests/hold-tap/{conditional/first-other-key-enabled => balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up}/keycode_events.snapshot (82%) create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap create mode 100644 app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi delete mode 100644 app/tests/hold-tap/conditional/enabler-other-key-out-of-order/native_posix.keymap delete mode 100644 app/tests/hold-tap/conditional/first-other-key-enabled/native_posix.keymap delete mode 100644 app/tests/hold-tap/conditional/first-other-key-not-enabled/native_posix.keymap diff --git a/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/events.patterns similarity index 100% rename from app/tests/hold-tap/conditional/enabler-other-key-out-of-order/events.patterns rename to app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..76a8ee5f --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/conditional/first-other-key-enabled/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/conditional/first-other-key-enabled/events.patterns rename to app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..76a8ee5f --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/conditional/first-other-key-not-enabled/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/conditional/first-other-key-not-enabled/events.patterns rename to app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/events.patterns diff --git a/app/tests/hold-tap/conditional/first-other-key-not-enabled/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot similarity index 63% rename from app/tests/hold-tap/conditional/first-other-key-not-enabled/keycode_events.snapshot rename to app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot index 08831e57..38bceb97 100644 --- a/app/tests/hold-tap/conditional/first-other-key-not-enabled/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -1,9 +1,7 @@ -ht_binding_pressed: 0 new undecided hold_tap -ht_decide: 0 decided tap (hold-preferred decision moment other-key-down) -kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 -kp_pressed: usage_page 0x07 keycode 0x0a implicit_mods 0x00 explicit_mods 0x00 -kp_released: usage_page 0x07 keycode 0x0a implicit_mods 0x00 explicit_mods 0x00 kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..55665057 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..cf6a9e4b --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot similarity index 86% rename from app/tests/hold-tap/conditional/enabler-other-key-out-of-order/keycode_events.snapshot rename to app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index a5b9f134..2b9f68cf 100644 --- a/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 -ht_decide: 0 decided tap (hold-preferred decision moment key-up) +ht_decide: 0 decided tap (balanced decision moment other-key-up) kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..2b9f68cf --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment other-key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..d06cd1ca --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/conditional/behavior_keymap.dtsi b/app/tests/hold-tap/balanced-conditionally-disabled/behavior_keymap.dtsi similarity index 62% rename from app/tests/hold-tap/conditional/behavior_keymap.dtsi rename to app/tests/hold-tap/balanced-conditionally-disabled/behavior_keymap.dtsi index b29859b2..fe8603c9 100644 --- a/app/tests/hold-tap/conditional/behavior_keymap.dtsi +++ b/app/tests/hold-tap/balanced-conditionally-disabled/behavior_keymap.dtsi @@ -4,15 +4,15 @@ / { behaviors { - cht_h: conditional_hold_tap_hold_preferred { + ht_bal: behavior_hold_tap_balanced { compatible = "zmk,behavior-hold-tap"; - label = "CONDITIONAL_HOLD_TAP"; + label = "HOLD_TAP_BALANCED"; #binding-cells = <2>; - flavor = "hold-preferred"; - tapping-term-ms = <1000>; + flavor = "balanced"; + tapping-term-ms = <300>; quick-tap-ms = <200>; bindings = <&kp>, <&kp>; - hold-enabler-keys = <1>; + hold-enabler-keys = <88>; }; }; @@ -22,9 +22,8 @@ default_layer { bindings = < - &cht_h LEFT_SHIFT F &kp D - &kp G - >; + &ht_bal LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; }; }; -}; \ No newline at end of file +}; diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..76a8ee5f --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..926174b4 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..38bceb97 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/conditional/first-other-key-enabled/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot similarity index 82% rename from app/tests/hold-tap/conditional/first-other-key-enabled/keycode_events.snapshot rename to app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index 1d2b827e..afbb52cf 100644 --- a/app/tests/hold-tap/conditional/first-other-key-enabled/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -ht_binding_pressed: 0 new undecided hold_tap -ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) -kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..242b31f2 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..55fd0854 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (balanced decision moment other-key-up) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..55fd0854 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (balanced decision moment other-key-up) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..d06cd1ca --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi b/app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi new file mode 100644 index 00000000..2e04fb6d --- /dev/null +++ b/app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_bal: behavior_hold_tap_balanced { + compatible = "zmk,behavior-hold-tap"; + label = "HOLD_TAP_BALANCED"; + #binding-cells = <2>; + flavor = "balanced"; + tapping-term-ms = <300>; + quick-tap-ms = <200>; + bindings = <&kp>, <&kp>; + hold-enabler-keys = <1 2 3>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_bal LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/native_posix.keymap b/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/native_posix.keymap deleted file mode 100644 index 657d71df..00000000 --- a/app/tests/hold-tap/conditional/enabler-other-key-out-of-order/native_posix.keymap +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include -#include "../behavior_keymap.dtsi" - -&kscan { - events = < - ZMK_MOCK_PRESS(0,1,100) /* enabled other key pressed */ - ZMK_MOCK_PRESS(0,0,100) /* cht pressed */ - ZMK_MOCK_RELEASE(0,1,100) /* enabled other key released */ - ZMK_MOCK_RELEASE(0,0,10) /* cht released */ - /* timer fires */ - >; -}; diff --git a/app/tests/hold-tap/conditional/first-other-key-enabled/native_posix.keymap b/app/tests/hold-tap/conditional/first-other-key-enabled/native_posix.keymap deleted file mode 100644 index 143ab428..00000000 --- a/app/tests/hold-tap/conditional/first-other-key-enabled/native_posix.keymap +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include -#include "../behavior_keymap.dtsi" - -&kscan { - events = < - ZMK_MOCK_PRESS(0,0,100) /* cht pressed */ - ZMK_MOCK_PRESS(0,1,100) /* enabled other key pressed */ - ZMK_MOCK_RELEASE(0,1,100) /* enabled other key released */ - ZMK_MOCK_RELEASE(0,0,10) /* cht released */ - /* timer fires */ - >; -}; diff --git a/app/tests/hold-tap/conditional/first-other-key-not-enabled/native_posix.keymap b/app/tests/hold-tap/conditional/first-other-key-not-enabled/native_posix.keymap deleted file mode 100644 index 27e848b7..00000000 --- a/app/tests/hold-tap/conditional/first-other-key-not-enabled/native_posix.keymap +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include -#include "../behavior_keymap.dtsi" - -&kscan { - events = < - ZMK_MOCK_PRESS(0,0,100) /* cht pressed */ - ZMK_MOCK_PRESS(1,0,100) /* disabled other key pressed */ - ZMK_MOCK_RELEASE(1,0,100) /* disabled other key released */ - ZMK_MOCK_PRESS(0,1,100) /* enabled other key pressed */ - ZMK_MOCK_RELEASE(0,1,100) /* enabled other key released */ - ZMK_MOCK_RELEASE(0,0,10) /* cht released */ - /* timer fires */ - >; -}; From b182e422b2445b78ea0d377621061a24f3949771 Mon Sep 17 00:00:00 2001 From: "jmding@gmail.com" Date: Mon, 13 Sep 2021 22:48:36 -0700 Subject: [PATCH 4/6] rename feature 'positional hold-tap', and rewrite (again) --- app/src/behaviors/behavior_hold_tap.c | 67 ++++++++++++------- .../1-dn-up/events.patterns | 0 .../1-dn-up/keycode_events.snapshot | 0 .../1-dn-up/native_posix.keymap | 0 .../2-dn-timer-up/events.patterns | 0 .../2-dn-timer-up}/keycode_events.snapshot | 2 +- .../2-dn-timer-up/native_posix.keymap | 0 .../3c-kcdn-dn-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../3c-kcdn-dn-kcup-up/native_posix.keymap | 0 .../3d-kcdn-dn-kcup-timer-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4a-dn-kcdn-timer-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4b-dn-kcdn-kcup-timer-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4c-dn-kcdn-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../4c-dn-kcdn-kcup-up/native_posix.keymap | 0 .../4d-dn-kcdn-timer-up-kcup/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../behavior_keymap.dtsi | 0 .../1-dn-up/events.patterns | 0 .../1-dn-up}/keycode_events.snapshot | 0 .../1-dn-up/native_posix.keymap | 0 .../2-dn-timer-up/events.patterns | 0 .../2-dn-timer-up/keycode_events.snapshot | 0 .../2-dn-timer-up/native_posix.keymap | 0 .../3c-kcdn-dn-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../3c-kcdn-dn-kcup-up/native_posix.keymap | 0 .../3d-kcdn-dn-kcup-timer-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4a-dn-kcdn-timer-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4b-dn-kcdn-kcup-timer-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../4c-dn-kcdn-kcup-up/events.patterns | 0 .../keycode_events.snapshot | 0 .../4c-dn-kcdn-kcup-up/native_posix.keymap | 0 .../4d-dn-kcdn-timer-up-kcup/events.patterns | 0 .../keycode_events.snapshot | 0 .../native_posix.keymap | 0 .../behavior_keymap.dtsi | 0 51 files changed, 42 insertions(+), 27 deletions(-) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/1-dn-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/1-dn-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/1-dn-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/2-dn-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled/1-dn-up => balanced-positional-disabled/2-dn-timer-up}/keycode_events.snapshot (80%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/2-dn-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3c-kcdn-dn-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3c-kcdn-dn-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3c-kcdn-dn-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3d-kcdn-dn-kcup-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/3d-kcdn-dn-kcup-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4a-dn-kcdn-timer-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4a-dn-kcdn-timer-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4b-dn-kcdn-kcup-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4b-dn-kcdn-kcup-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4c-dn-kcdn-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4c-dn-kcdn-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4c-dn-kcdn-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4d-dn-kcdn-timer-up-kcup/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/4d-dn-kcdn-timer-up-kcup/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled => balanced-positional-disabled}/behavior_keymap.dtsi (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/1-dn-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-disabled/2-dn-timer-up => balanced-positional-enabled/1-dn-up}/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/1-dn-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/2-dn-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/2-dn-timer-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/2-dn-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3c-kcdn-dn-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3c-kcdn-dn-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3c-kcdn-dn-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3d-kcdn-dn-kcup-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/3d-kcdn-dn-kcup-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4a-dn-kcdn-timer-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4a-dn-kcdn-timer-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4b-dn-kcdn-kcup-timer-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4b-dn-kcdn-kcup-timer-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4c-dn-kcdn-kcup-up/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4c-dn-kcdn-kcup-up/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4c-dn-kcdn-kcup-up/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4d-dn-kcdn-timer-up-kcup/events.patterns (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/4d-dn-kcdn-timer-up-kcup/native_posix.keymap (100%) rename app/tests/hold-tap/{balanced-conditionally-enabled => balanced-positional-enabled}/behavior_keymap.dtsi (100%) diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 317be061..33d02833 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -72,6 +72,9 @@ struct active_hold_tap { const struct behavior_hold_tap_config *config; struct k_delayed_work work; bool work_is_cancelled; + + // initialized to -1, which is to be interpreted as "no other key has been pressed yet" + int32_t position_of_first_other_key_pressed; }; // The undecided hold tap is the hold tap that needs to be decided before @@ -208,6 +211,7 @@ static struct active_hold_tap *store_hold_tap(uint32_t position, uint32_t param_ active_hold_taps[i].param_hold = param_hold; active_hold_taps[i].param_tap = param_tap; active_hold_taps[i].timestamp = timestamp; + active_hold_taps[i].position_of_first_other_key_pressed = -1; return &active_hold_taps[i]; } return NULL; @@ -361,10 +365,21 @@ static int release_binding(struct active_hold_tap *hold_tap) { return behavior_keymap_binding_released(&binding, event); } +static bool is_positional_hold_tap_enabled(struct active_hold_tap *hold_tap) { + return (hold_tap->config->hold_enabler_keys_len > 0); +} + +static bool passes_positional_hold_conditions(struct active_hold_tap *hold_tap) { + for (int i = 0; i < hold_tap->config->hold_enabler_keys_len; i++) { + if (hold_tap->config->hold_enabler_keys[i] == hold_tap->position_of_first_other_key_pressed) { + return true; + } + } + return false; +} + static void -decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_moment, - int32_t other_key_down_position // use -1 if decision_moment != HT_OTHER_KEY_DOWN -) { +decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_moment) { if (hold_tap->status != STATUS_UNDECIDED) { return; } @@ -374,21 +389,6 @@ decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_ return; } - // For conditional hold-tap behaviors that have failed to meet the required prerequisites - // for a hold decision, force a tap decision. - if (decision_moment == HT_OTHER_KEY_DOWN && hold_tap->config->hold_enabler_keys_len > 0) { - bool does_other_key_down_enable_hold_behavior = false; - for (int i = 0; i < hold_tap->config->hold_enabler_keys_len; i++) { - does_other_key_down_enable_hold_behavior = - does_other_key_down_enable_hold_behavior || - (hold_tap->config->hold_enabler_keys[i] == other_key_down_position); - } - - if (!does_other_key_down_enable_hold_behavior) { - hold_tap->status = STATUS_TAP; - } - } - // If the hold-tap behavior is still undecided, attempt to decide it. if (hold_tap->status == STATUS_UNDECIDED) { switch (hold_tap->config->flavor) { @@ -401,11 +401,19 @@ decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_ } } - // If the hold-tap behavior is still undecided, exit out. + // If the hold-tap behavior is still undecided, something went wrong. Gracefully fail by exiting. if (hold_tap->status == STATUS_UNDECIDED) { return; } + // If positional hold-tap is enabled, force a decision if the positional conditiosn for + // a hold decision are not met. + if ( + is_positional_hold_tap_enabled(hold_tap) && + !passes_positional_hold_conditions(hold_tap)) { + hold_tap->status = STATUS_TAP; + } + // Since the hold-tap has been decided, clean up undecided_hold_tap and // execute the decided behavior. LOG_DBG("%d decided %s (%s decision moment %s)", hold_tap->position, @@ -468,7 +476,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding, undecided_hold_tap = hold_tap; if (is_quick_tap(hold_tap)) { - decide_hold_tap(hold_tap, HT_QUICK_TAP, -1); + decide_hold_tap(hold_tap, HT_QUICK_TAP); } // if this behavior was queued we have to adjust the timer to only @@ -491,10 +499,10 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding, // We insert a timer event before the TH_KEY_UP event to verify. int work_cancel_result = k_delayed_work_cancel(&hold_tap->work); if (event.timestamp > (hold_tap->timestamp + hold_tap->config->tapping_term_ms)) { - decide_hold_tap(hold_tap, HT_TIMER_EVENT, -1); + decide_hold_tap(hold_tap, HT_TIMER_EVENT); } - decide_hold_tap(hold_tap, HT_KEY_UP, -1); + decide_hold_tap(hold_tap, HT_KEY_UP); decide_retro_tap(hold_tap); release_binding(hold_tap); @@ -526,6 +534,14 @@ static int position_state_changed_listener(const zmk_event_t *eh) { return ZMK_EV_EVENT_BUBBLE; } + // Store the position of pressed key for positional hold-tap purposes. + if ( + (ev->state) // i.e. key pressed (not released) + && (undecided_hold_tap->position_of_first_other_key_pressed == -1) // i.e. no other key has been pressed yet + ) { + undecided_hold_tap->position_of_first_other_key_pressed = ev->position; + } + if (undecided_hold_tap->position == ev->position) { if (ev->state) { // keydown LOG_ERR("hold-tap listener should be called before before most other listeners!"); @@ -541,7 +557,7 @@ static int position_state_changed_listener(const zmk_event_t *eh) { // have run out. if (ev->timestamp > (undecided_hold_tap->timestamp + undecided_hold_tap->config->tapping_term_ms)) { - decide_hold_tap(undecided_hold_tap, HT_TIMER_EVENT, -1); + decide_hold_tap(undecided_hold_tap, HT_TIMER_EVENT); } if (!ev->state && find_captured_keydown_event(ev->position) == NULL) { @@ -555,8 +571,7 @@ static int position_state_changed_listener(const zmk_event_t *eh) { LOG_DBG("%d capturing %d %s event", undecided_hold_tap->position, ev->position, ev->state ? "down" : "up"); capture_event(eh); - decide_hold_tap(undecided_hold_tap, ev->state ? HT_OTHER_KEY_DOWN : HT_OTHER_KEY_UP, - ev->state ? ev->position : -1); + decide_hold_tap(undecided_hold_tap, ev->state ? HT_OTHER_KEY_DOWN : HT_OTHER_KEY_UP); return ZMK_EV_EVENT_CAPTURED; } @@ -602,7 +617,7 @@ void behavior_hold_tap_timer_work_handler(struct k_work *item) { if (hold_tap->work_is_cancelled) { clear_hold_tap(hold_tap); } else { - decide_hold_tap(hold_tap, HT_TIMER_EVENT, -1); + decide_hold_tap(hold_tap, HT_TIMER_EVENT); } } diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/1-dn-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/1-dn-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/1-dn-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/1-dn-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/1-dn-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/1-dn-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/1-dn-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/keycode_events.snapshot similarity index 80% rename from app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/keycode_events.snapshot index 76a8ee5f..ff1caa0e 100644 --- a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap -ht_decide: 0 decided tap (balanced decision moment key-up) +ht_decide: 0 decided tap (balanced decision moment timer) kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/2-dn-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns rename to app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/behavior_keymap.dtsi b/app/tests/hold-tap/balanced-positional-disabled/behavior_keymap.dtsi similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/behavior_keymap.dtsi rename to app/tests/hold-tap/balanced-positional-disabled/behavior_keymap.dtsi diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/1-dn-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/1-dn-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/1-dn-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-disabled/2-dn-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/1-dn-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/1-dn-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/1-dn-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/1-dn-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/2-dn-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns rename to app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot rename to app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap rename to app/tests/hold-tap/balanced-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap diff --git a/app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi b/app/tests/hold-tap/balanced-positional-enabled/behavior_keymap.dtsi similarity index 100% rename from app/tests/hold-tap/balanced-conditionally-enabled/behavior_keymap.dtsi rename to app/tests/hold-tap/balanced-positional-enabled/behavior_keymap.dtsi From 110285fdd576347e21ccc8dca39c4f08bbb92b44 Mon Sep 17 00:00:00 2001 From: jmding8 <44815547+jmding8@users.noreply.github.com> Date: Mon, 13 Sep 2021 22:55:16 -0700 Subject: [PATCH 5/6] Update hold-tap.md Conditional -> positional in docs --- docs/docs/behaviors/hold-tap.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index 7c9cfb96..675035b0 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -95,9 +95,9 @@ 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. -#### Conditional hold-tap and `hold-enabler-keys` +#### Positional hold-tap and `hold-enabler-keys` -Including `hold-enabler-keys` in your hold-tap behavior definition turns on conditional hold-tap. This causes the hold-tap behavior to only be allowed to produce a hold behavior if the next key pressed is one of the `hold-enabler-keys`. For example, with the following configuration: +Including `hold-enabler-keys` in your hold-tap behavior definition turns on positional hold-tap. This causes the hold-tap behavior to only be allowed to produce a hold behavior if the next key pressed is one of the `hold-enabler-keys`. For example, with the following configuration: ``` #include @@ -105,9 +105,9 @@ Including `hold-enabler-keys` in your hold-tap behavior definition turns on cond / { behaviors { - cht: conditional_hold_tap { + pht: positional_hold_tap { compatible = "zmk,behavior-hold-tap"; - label = "CONDITIONAL_HOLD_TAP"; + label = "POSITIONAL_HOLD_TAP"; #binding-cells = <2>; flavor = "hold-preferred"; tapping-term-ms = <400>; @@ -129,13 +129,13 @@ Including `hold-enabler-keys` in your hold-tap behavior definition turns on cond }; ``` -The sequence `(cht_down, W_down, W_up, E_down, E_up, cht_up)` produces `WE`, because the conditional hold-tap **IS** permitted to produce a hold behavior, because the next key pressed (the W key in position 1) **IS** one of the hold-enabler-keys. +The sequence `(cht_down, W_down, W_up, E_down, E_up, cht_up)` produces `WE`, because the positional hold-tap **IS** permitted to produce a hold behavior, because the next key pressed (the W key in position 1) **IS** one of the hold-enabler-keys. -Meanwhile, the sequence `(cht_down, E_down, E_up, W_down, W_up cht_up)` produces `qew`, because the conditional hold-tap is **NOT** permitted to produce a hold behavior, because the next key pressed (the E key in position 2) is **NOT** one of the hold-enabler-keys. +Meanwhile, the sequence `(cht_down, E_down, E_up, W_down, W_up cht_up)` produces `qew`, because the positional hold-tap is **NOT** permitted to produce a hold behavior, because the next key pressed (the E key in position 2) is **NOT** one of the hold-enabler-keys. -Conditional hold-taps can be useful with home-row modifiers for example. By setting `hold-enabler-keys` to include only the keys controlled by the opposite hand, conditional hold-taps can prevent one-handed "rolls" from accidentally triggering hold behaviors. +Positional hold-taps can be useful with home-row modifiers for example. By setting `hold-enabler-keys` to include only the keys controlled by the opposite hand, positional hold-taps can prevent one-handed "rolls" from accidentally triggering hold behaviors. -Note that while for regular hold-tap behaviors a shorter `tapping-term` encourages hold decisions, the opposite is true for conditional hold-tap behaviors. For conditional hold-taps, a shorter `tapping-term` actually encourages tap decisions. This is because when the `tapping-term` expires, this triggers the behavior to decide as either a tap or a hold. But if the user has not yet had time to press one of the `hold-enabler-keys`, then the behavior will decide as a tap. Shortening the `tapping-term` thus gives the user less time to press one of the `hold-enabler-keys` to produce a hold behavior. +Note that while for regular hold-tap behaviors a shorter `tapping-term` encourages hold decisions, the opposite is true for positional hold-tap behaviors. For positional hold-taps, a shorter `tapping-term` actually encourages tap decisions. This is because when the `tapping-term` expires, this triggers the behavior to decide as either a tap or a hold. But if the user has not yet had time to press one of the `hold-enabler-keys`, then the behavior will decide as a tap. Shortening the `tapping-term` thus gives the user less time to press one of the `hold-enabler-keys` to produce a hold behavior. #### Comparison to QMK From 48888318d14cc859b9b00bf1369d876c346bbf99 Mon Sep 17 00:00:00 2001 From: "jmding@gmail.com" Date: Wed, 15 Sep 2021 05:19:01 +0000 Subject: [PATCH 6/6] clang, more tests --- app/src/behaviors/behavior_hold_tap.c | 18 +++++------- .../2-dn-timer-up/keycode_events.snapshot | 6 ++-- .../keycode_events.snapshot | 6 ++-- .../1-dn-up/events.patterns | 4 +++ .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up/events.patterns | 4 +++ .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 29 +++++++++++++++++++ .../1-dn-up/events.patterns | 4 +++ .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up/events.patterns | 4 +++ .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 29 +++++++++++++++++++ .../1-dn-up/events.patterns | 4 +++ .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up/events.patterns | 4 +++ .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 29 +++++++++++++++++++ .../1-dn-up/events.patterns | 4 +++ .../1-dn-up/keycode_events.snapshot | 5 ++++ .../1-dn-up/native_posix.keymap | 11 +++++++ .../2-dn-timer-up/events.patterns | 4 +++ .../2-dn-timer-up/keycode_events.snapshot | 5 ++++ .../2-dn-timer-up/native_posix.keymap | 11 +++++++ .../3c-kcdn-dn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../3c-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++ .../3d-kcdn-dn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 13 +++++++++ .../4a-dn-kcdn-timer-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4b-dn-kcdn-kcup-timer-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../4c-dn-kcdn-kcup-up/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../4c-dn-kcdn-kcup-up/native_posix.keymap | 14 +++++++++ .../4d-dn-kcdn-timer-up-kcup/events.patterns | 4 +++ .../keycode_events.snapshot | 7 +++++ .../native_posix.keymap | 14 +++++++++ .../behavior_keymap.dtsi | 29 +++++++++++++++++++ docs/docs/behaviors/hold-tap.md | 10 +++---- 104 files changed, 887 insertions(+), 21 deletions(-) create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-disabled/behavior_keymap.dtsi create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred-positional-enabled/behavior_keymap.dtsi create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-disabled/behavior_keymap.dtsi create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred-positional-enabled/behavior_keymap.dtsi diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 33d02833..82e097b8 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -371,15 +371,16 @@ static bool is_positional_hold_tap_enabled(struct active_hold_tap *hold_tap) { static bool passes_positional_hold_conditions(struct active_hold_tap *hold_tap) { for (int i = 0; i < hold_tap->config->hold_enabler_keys_len; i++) { - if (hold_tap->config->hold_enabler_keys[i] == hold_tap->position_of_first_other_key_pressed) { + if (hold_tap->config->hold_enabler_keys[i] == + hold_tap->position_of_first_other_key_pressed) { return true; } } return false; } -static void -decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_moment) { +static void decide_hold_tap(struct active_hold_tap *hold_tap, + enum decision_moment decision_moment) { if (hold_tap->status != STATUS_UNDECIDED) { return; } @@ -401,16 +402,13 @@ decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_moment decision_ } } - // If the hold-tap behavior is still undecided, something went wrong. Gracefully fail by exiting. if (hold_tap->status == STATUS_UNDECIDED) { return; } // If positional hold-tap is enabled, force a decision if the positional conditiosn for // a hold decision are not met. - if ( - is_positional_hold_tap_enabled(hold_tap) && - !passes_positional_hold_conditions(hold_tap)) { + if (is_positional_hold_tap_enabled(hold_tap) && !passes_positional_hold_conditions(hold_tap)) { hold_tap->status = STATUS_TAP; } @@ -535,9 +533,9 @@ static int position_state_changed_listener(const zmk_event_t *eh) { } // Store the position of pressed key for positional hold-tap purposes. - if ( - (ev->state) // i.e. key pressed (not released) - && (undecided_hold_tap->position_of_first_other_key_pressed == -1) // i.e. no other key has been pressed yet + if ((ev->state) // i.e. key pressed (not released) + && (undecided_hold_tap->position_of_first_other_key_pressed == + -1) // i.e. no other key has been pressed yet ) { undecided_hold_tap->position_of_first_other_key_pressed = ev->position; } diff --git a/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot index 926174b4..ff1caa0e 100644 --- a/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-positional-enabled/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap -ht_decide: 0 decided hold-timer (balanced decision moment timer) -kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 -kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index afbb52cf..55665057 100644 --- a/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 ht_binding_pressed: 0 new undecided hold_tap kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 -ht_decide: 0 decided hold-timer (balanced decision moment timer) -kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 -kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..36dc281a --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..0ad6f63f --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..a5b9f134 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (hold-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..d74affca --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..f7853185 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..f7853185 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..f7853185 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..33d97686 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-disabled/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred-positional-disabled/behavior_keymap.dtsi new file mode 100644 index 00000000..ae0e019c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-disabled/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_hold: behavior_hold_tap_hold_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "HOLD_TAP_HOLD_PREFERRED"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <200>; + bindings = <&kp>, <&kp>; + hold-enabler-keys = <88>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_hold LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..36dc281a --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..0ad6f63f --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..a5b9f134 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (hold-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..d74affca --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..1d2b827e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..1d2b827e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..1d2b827e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..ef3ea562 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred-positional-enabled/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred-positional-enabled/behavior_keymap.dtsi new file mode 100644 index 00000000..f2e742b5 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred-positional-enabled/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_hold: behavior_hold_tap_hold_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "HOLD_TAP_HOLD_PREFERRED"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <200>; + bindings = <&kp>, <&kp>; + hold-enabler-keys = <1 2 3>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_hold LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..d1f01261 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..a4af111b --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..72e3755a --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..691b75ff --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..119935eb --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..119935eb --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..93fa43be --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..e10f263e --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-disabled/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred-positional-disabled/behavior_keymap.dtsi new file mode 100644 index 00000000..b19c4c98 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-disabled/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_tap: behavior_hold_tap_tap_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "HOLD_TAP_TAP_PREFERRED"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <200>; + bindings = <&kp>, <&kp>; + hold-enabler-keys = <88>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_tap LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/keycode_events.snapshot new file mode 100644 index 00000000..d1f01261 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/native_posix.keymap new file mode 100644 index 00000000..040cdd3e --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/1-dn-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..a4af111b --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/keycode_events.snapshot @@ -0,0 +1,5 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap new file mode 100644 index 00000000..11d033f4 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/2-dn-timer-up/native_posix.keymap @@ -0,0 +1,11 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,500) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..72e3755a --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..21baa447 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /*d*/ + ZMK_MOCK_PRESS(0,0,100) /*mt f-shift */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..691b75ff --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_decide: 0 decided tap (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..cd7ff384 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) /* d */ + ZMK_MOCK_PRESS(0,0,100) /* mt f-shift */ + ZMK_MOCK_RELEASE(1,0,400) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..2d985568 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap new file mode 100644 index 00000000..bdfaf9d3 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,200) + ZMK_MOCK_PRESS(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot new file mode 100644 index 00000000..2d985568 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap new file mode 100644 index 00000000..c0fd1bd1 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(1,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 00000000..93fa43be --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 00000000..69c19676 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* timer */ + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot new file mode 100644 index 00000000..e10f263e --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -0,0 +1,7 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap new file mode 100644 index 00000000..301ef0ac --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,100) + ZMK_MOCK_PRESS(1,0,100) + ZMK_MOCK_RELEASE(0,0,200) + /* timer fires */ + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred-positional-enabled/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred-positional-enabled/behavior_keymap.dtsi new file mode 100644 index 00000000..5ab10748 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred-positional-enabled/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_tap: behavior_hold_tap_tap_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "HOLD_TAP_TAP_PREFERRED"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <200>; + bindings = <&kp>, <&kp>; + hold-enabler-keys = <1 2 3>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_tap LEFT_SHIFT F &kp J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index 675035b0..827ce7ef 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -97,7 +97,7 @@ If this config does not work for you, try the flavor "balanced" with a medium `t #### Positional hold-tap and `hold-enabler-keys` -Including `hold-enabler-keys` in your hold-tap behavior definition turns on positional hold-tap. This causes the hold-tap behavior to only be allowed to produce a hold behavior if the next key pressed is one of the `hold-enabler-keys`. For example, with the following configuration: +Including `hold-enabler-keys` in your hold-tap behavior definition enables the positional hold-tap feature. With positional hold-tap enabled, your hold-tap behavior will only produce a hold behavior if while the hold-tap key is still pressed, the first other key to be pressed is one of the `hold-enabler-keys`. For example, with the following hold-tap behavior definiton: ``` #include @@ -129,13 +129,13 @@ Including `hold-enabler-keys` in your hold-tap behavior definition turns on posi }; ``` -The sequence `(cht_down, W_down, W_up, E_down, E_up, cht_up)` produces `WE`, because the positional hold-tap **IS** permitted to produce a hold behavior, because the next key pressed (the W key in position 1) **IS** one of the hold-enabler-keys. +The sequence `(cht_down, W_down, W_up, E_down, E_up, cht_up)` produces `WE`. The positional hold-tap **IS** permitted to produce a hold behavior, because the first key pressed after the hold-tap key (i.e. the W key, in position 1) **IS** one of the `hold-enabler-keys`. -Meanwhile, the sequence `(cht_down, E_down, E_up, W_down, W_up cht_up)` produces `qew`, because the positional hold-tap is **NOT** permitted to produce a hold behavior, because the next key pressed (the E key in position 2) is **NOT** one of the hold-enabler-keys. +Meanwhile, the sequence `(cht_down, E_down, E_up, W_down, W_up cht_up)` produces `qew`. The positional hold-tap is **NOT** permitted to produce a hold behavior, because the first key pressed after the hold-tap key (i.e. the E key, in position 2) is **NOT** one of the `hold-enabler-keys`. -Positional hold-taps can be useful with home-row modifiers for example. By setting `hold-enabler-keys` to include only the keys controlled by the opposite hand, positional hold-taps can prevent one-handed "rolls" from accidentally triggering hold behaviors. +Positional hold-taps can be useful with home-row modifiers. By using a positional hold-tap behavior for home-row modifiers on the left hand, and setting `hold-enabler-keys` to the keys under the right hand, positional hold-tap will only allow hold behaviors to occur with cross-hand keypresses. -Note that while for regular hold-tap behaviors a shorter `tapping-term` encourages hold decisions, the opposite is true for positional hold-tap behaviors. For positional hold-taps, a shorter `tapping-term` actually encourages tap decisions. This is because when the `tapping-term` expires, this triggers the behavior to decide as either a tap or a hold. But if the user has not yet had time to press one of the `hold-enabler-keys`, then the behavior will decide as a tap. Shortening the `tapping-term` thus gives the user less time to press one of the `hold-enabler-keys` to produce a hold behavior. +Note that for regular hold-tap behaviors a shorter `tapping-term` encourages hold decisions. However the opposite is true for positional hold-tap behaviors, where a shorter `tapping-term` actually encourages tap decisions. This is because when the `tapping-term` expires, this triggers the behavior to decide as either a tap or a hold. But if the user has not yet had time to press one of the `hold-enabler-keys`, then with positional hold-tap the behavior will decide as a tap. #### Comparison to QMK