kmk_firmware icon indicating copy to clipboard operation
kmk_firmware copied to clipboard

Rolling from ModTap key to Layer tap key (KC.LT) results in keypresses being emitted out of order

Open DBendit opened this issue 2 years ago • 4 comments

Issue

When rolling from a ModTap key to a Layer tap key, the Layer tap key is emitted before the ModTap key.

Replication instructions

Using the following config: https://gist.github.com/DBendit/d094873364e37f36d80ccf9f71f2d8ac

Roll from 'l' to 'a'. 'l' is configured as a ModTap key (i.e. KC.MT), and 'a' is configured as a Layer tap key (i.e. KC.LT).

Expected results

The output should be 'la'.

Actual results

The output is instead 'al', with the following debug logs: https://gist.github.com/DBendit/f9906968246de3e8a1da4ec59f9d6e67

Misc

I originally ran into this without tap_interrupted=True, prefer_hold=False on the KC.LT keys, but adding those setting didn't help either. This is a frustrating experience trying to use home row mods where one of the home row keys on each hand is a layer shift.

I've been able to replicate this with keys on both sides of the split, as well as on the same side of the split (e.g. 's' and 'a').

Here's a debug log from 'ls', which works correctly. Notably, there's no ht_activate_on_interrupt event in this case. https://gist.github.com/DBendit/9c52e0290d2981822ea902bda25393d5

DBendit avatar Nov 21 '22 03:11 DBendit

Workaround: Rather than using KC.LT, use KC.MT(KC.Key, KC.MO(<layer>)). This is effectively what the layer module does anyway, but it keeps all of the logic inside of the ModTap module.

DBendit avatar Nov 21 '22 04:11 DBendit

tap_interrupted=True is almost definitely not what you want. Only pass prefer_hold=False to both KC.LT and KC.MT, that should do the trick.

xs5871 avatar Nov 21 '22 20:11 xs5871

@xs5871 You're right - getting rid of the tap_interrupted=True params from all of the mod/layer tap keys did get rid of the issue. It still doesn't explain why the behavior seen above happens differently for ModTap-only rolls vs ModTap-to-layer-tap rolls.

DBendit avatar Nov 21 '22 22:11 DBendit

I don't have an immediate answer to that, and if you're issue is fixed, I'm not going to further investigate it for the time being.

xs5871 avatar Nov 24 '22 08:11 xs5871