zmkfirmware / zmk

ZMK Firmware Repository
https://zmk.dev/
MIT License
2.67k stars 2.74k forks source link

`hold-trigger-on-release` cancels effect of `hold-trigger-key-positions` with `flavor = "tap-unless-interrupted";` #2328

Open PsychoThinker opened 3 months ago

PsychoThinker commented 3 months ago

Issue

It seems to me that a configuration like the one below should work (I would like to achieve the behaviour described in this thread: reddit) - the hold functionality should ONLY be able to be triggered in scenarios when a key on the left half (e.g. A) is held down and any on the right half is pressed - and it does, but on the condition that we remove hold-trigger-on-release from this configuration (unfortunately it is an option we cannot give up if we want to be able to use more than one modifier).

Is there any reason why the options mentioned in the title do not work well together?

Code

#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>

/ {
    behaviors {
        lh_pht: left_positional_hold_tap {
            compatible = "zmk,behavior-hold-tap";
            #binding-cells = <2>;
            flavor = "tap-unless-interrupted";
            tapping-term-ms = <500>;
            quick-tap-ms = <250>;
            bindings = <&kp>, <&kp>;
            hold-trigger-key-positions = <5 6 7 8 9 10>;
            hold-trigger-on-release;
        };
    };

    keymap {
        compatible = "zmk,keymap";
        default_layer {
            bindings = <
                // position 0     pos 1             pos 2             pos 3             pos 4    pos 5    pos 6    pos 7    pos 8    pos 9    pos 10
                &lh_pht LSFT A    &lh_pht LGUI S    &lh_pht LALT D    &lh_pht LCTL F    &kp G    &kp H    &kp I    &kp J    &kp K    &kp L    &kp SEMI
            >;
        };
    };
};