zmkfirmware / zmk

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

Combo + &mt => Combo wins #2314

Closed arialdomartini closed 1 month ago

arialdomartini commented 1 month ago

I would like the following behavior:

Key When Behavior
D Tapped D
D Held down Ctrl
F Tapped F
F Held down Shift
D+F Tapped G
D+F Held down Shift + Ctrl

Therefore, I configured:

Key Configuration
F &mt LSHIFT F
D &mt LCTRL D

plus a combo:

combo_G {
  timeout-ms = <50>;
  key-positions = <12 13>;
  bindings = <&kp G>;
};

All works but the very last combination: D+F held down activate the combo instead of the 2 modifiers.

Any idea how to make it work?

arialdomartini commented 1 month ago

Browsing the past issues and comments, I found this that may be relevant:

https://github.com/zmkfirmware/zmk/issues/45#issuecomment-746399029

caksoylar commented 1 month ago

Combos capture key presses processed before regular behavior logic so this is normal. You can make the combo binding itself a mod-tap like &mt LC(LSHIFT) G so that you still get ctrl+shift on hold, or you can slightly stagger the key presses so that you don't trigger the combo.

QMK has a setting called COMBO_MUST_TAP that assumes that combo shouldn't fire if it is a long press on the source keys. Absent a setting like that there isn't a way for the firmware to know whether you intended a long press G or ctrl+shift.

arialdomartini commented 1 month ago

@caksoylar I works perfectly. Amazing. Thank you also for the hint on QMK. You are amazing.