zmkfirmware / zmk

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

Hold-taps should honor transparency within the bindings. #2368

Open amacleod opened 3 months ago

amacleod commented 3 months ago

When one of the bindings of a hold-tap is &trans, the behavior should look at lower layers' bindings when that portion of the hold-tap is activated.

behaviors {
  hmt: homerow_mod_transparent {
    compatible = "zmk,behavior-hold-tap";
    #binding-cells = <2>;
    bindings = <&kp>, <&trans>;
    // ... and any other mandatory fields
  };
};
keymap {
  base_layer { bindings = <&kp A>; };
  other_layer { bindings = <&kp B>; };
  overlay_mods_layer {
    bindings = <&hmt LSHFT 0>;
  };
};

Expected behavior: when the overlay mods layer is active, tapping the key should either send a or b depending on which lower layer is active.

Actual behavior: tapping the key does nothing when the overlay layer is active, just as if the second binding were &none. The hold behavior works fine.


https://github.com/amacleod/zmk-config/blob/hold-tap-trans-repro/config/corne.keymap#L381-L391 is an example of me trying to use a transparent hold-tap to make a floating home row mods layer.

amacleod commented 3 months ago

Linking the locality-preservation issue https://github.com/zmkfirmware/zmk/issues/1494 as @caksoylar mentioned that it might be related