zmkfirmware / zmk

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

Keys used in combos are not reflected with mouse clicks before timeout. #2281

Open joonhyuk opened 2 months ago

joonhyuk commented 2 months ago

I'm currently using both shift keys in a combo, and if I shift+click (select text from the current cursor) before the timeout, it just clicks.

I've investigated the keystrokes with the event viewer and found that for the keys used in the combo, the key down only happens after the timeout if I hold the key down. Of course, the collaboration with other keys or just tapping, it happens immediately without any problem.

As far as I can tell, the problem is only with mouse clicks.

caksoylar commented 2 months ago

I think this is the expected behavior given the current feature set of combos. Essentially, when a key involved in a combo is pressed, it will wait for either:

to decide that it, in fact, doesn't resolve to a combo and should invoke the underlying behavior (shift here). Since the keyboard doesn't know about any mouse clicks, it cannot shortcut the decision like the second case.

In theory, the combos could have a property similar to the newly added hold-while-undecided property for hold-taps to invoke the mod before it resolves to the combo or not. But in practice, you can probably set the combo timeout short enough (like 60ms) that the delay is imperceptible for mouse use.