Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OneShot key or StickyKeys doesn't work with LT #1021

Open
ikeji opened this issue Aug 25, 2024 · 2 comments
Open

[BUG] OneShot key or StickyKeys doesn't work with LT #1021

ikeji opened this issue Aug 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ikeji
Copy link

ikeji commented Aug 25, 2024

Describe the bug
When I type OneShot key then LT key, OneShot key is deactivate before LT key activate.

To Reproduce

Steps to reproduce the behavior:

  • Setup 3 keys like
    • K1: KC.OS(KC.LCTL)
    • K2: KC.LT(1, KC.B)
    • K3: KC.C
  • Type key K1 then type key K3
  • Type key K1 then type key K2

Expected behavior

  • Type key K1 then type key K3
    • Expected event sequence: Ctrl key down, Key "C" down, Key "C" up, Ctrl key up.
  • Type key K1 then type key K2
    • Expected event sequence: Ctrl key down, Key "B" down, Key "B" up, Ctrl key up.

Actual behavior

  • Type key K1 then type key K3 (Same as expected)
    • Expected event sequence: Ctrl key down, Key "C" down, Key "C" up, Ctrl key up.
  • Type key K1 then type key K2
    • Expected event sequence: Ctrl key down, Ctrl key up, Key "B" down, Key "B" up.

Debug output

Here is an output from kmk firmware.
https://gist.github.com/ikeji/c51d65e28ecd7a8451ab10760e00b68d

Additional context

I use RP2040 and CircuitPython 8.2.9.
Here is a full source code:
https://gist.github.com/ikeji/fb81363d50b842eaa80f5641ec0bba8c

@ikeji ikeji added the bug Something isn't working label Aug 25, 2024
@xs5871
Copy link
Collaborator

xs5871 commented Aug 26, 2024

The oneshot module is deprecated, please use sticky keys instead.

@ikeji ikeji changed the title [BUG] OneShot key doesn't work with LT [BUG] OneShot key or StickyKeys doesn't work with LT Aug 27, 2024
@ikeji
Copy link
Author

ikeji commented Aug 27, 2024

Thanks for reply.

The sticky_keys module also have unexpected behavior.
And I can't type key inside layer with.

Setup

keyboard.keymap = [
    [ KC.SK(KC.LCTL), KC.LT(1, KC.B), KC.C, ],
    [ KC.D, KC.TRANS, KC.F, ],
]

Input

  • Type key 1, Hold key 2, Type key3, Release key 2

Expected output

  • Ctrl key down, Key "F" down, Key "F" up, Ctrl key up

Actual output

  • Ctrl key down, Ctrl key up, Key "F" down, Key "F" up

Debug output

575407 kmk.keyboard: <Event: key_number 0 pressed>: StickyKey
575409 kmk.keyboard: coordkeys_pressed={0: StickyKey}
575411 kmk.modules.sticky_keys: activate
575414 kmk.keyboard: keys_pressed={ModifierKey(code=1)}
575543 kmk.keyboard: <Event: key_number 0 released>: StickyKey
575546 kmk.keyboard: coordkeys_pressed={}
575816 kmk.keyboard: <Event: key_number 1 pressed>: HoldTapKey
575819 kmk.keyboard: coordkeys_pressed={1: HoldTapKey}
576123 kmk.modules.holdtap: ht_activate_hold
576128 kmk.modules.layers: active_layers=[1, 0]
576168 kmk.keyboard: <Event: key_number 2 pressed>: KeyboardKey(code=14)
576172 kmk.modules.sticky_keys: deactivate
576174 kmk.keyboard: coordkeys_pressed={2: None, 1: HoldTapKey}
576180 kmk.keyboard: coordkeys_pressed={2: KeyboardKey(code=14), 1: HoldTapKey}
576184 kmk.keyboard: keys_pressed={KeyboardKey(code=14)}
576344 kmk.keyboard: <Event: key_number 2 released>: KeyboardKey(code=14)
576349 kmk.keyboard: coordkeys_pressed={1: HoldTapKey}
576500 kmk.keyboard: <Event: key_number 1 released>: HoldTapKey
576503 kmk.keyboard: coordkeys_pressed={}
576504 kmk.modules.holdtap: ht_deactivate_hold
576508 kmk.modules.layers: active_layers=[0]

Here is a full code:
https://gist.github.com/ikeji/abf1e2bfe7149309acc3606cc70619a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants