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

Feature request: Sticky key “cancel” key #834

Open
dxmh opened this issue Jun 11, 2021 · 3 comments
Open

Feature request: Sticky key “cancel” key #834

dxmh opened this issue Jun 11, 2021 · 3 comments

Comments

@dxmh
Copy link
Collaborator

dxmh commented Jun 11, 2021

Current behaviour:

  • Sticky keys are cancelled after a timeout

Desired behaviour:

  • Sticky keys are cancelled after a timeout, OR
  • Sticky keys are cancelled with a key

Examples:

With &kp ESCAPE configured as cancel key:

  • Tap &sk LSHIFT, &kp A = A (uppercase)
  • Tap &sk LSHIFT, &kp ESC, &kp A = a (lowercase)

With &mo NAV configured as cancel key:

  • Tap &sk LSHIFT, &mo NAV, &kp A = a (lowercase)
@dxmh
Copy link
Collaborator Author

dxmh commented Sep 10, 2021

Another idea... In #829 (comment) this was suggested:

Could you not have it look at whether the key pressed is another sticky key instead of modifier?

This made me think - when checking if the key being pressed is also sticky, or a modifier, or whatever, it could also check if the key being pressed is itself and then cancel/unstick if so.

This would allow for an experience very similar to Callum Oakley's popular one-shot key implementation: https://github.com/callum-oakley/qmk_firmware/blob/master/users/callum/readme.md (documentation link).

@daliusd
Copy link

daliusd commented Sep 11, 2021

I have improved Callum one-shot key implementation with layers (details here https://blog.ffff.lt/posts/callum-layers/) and found out that potentially I need different cancel keys for one-shot modifiers and one-shot layers. Just to make everything more complicated 😄

dxmh added a commit to dxmh/zmk-config that referenced this issue Nov 27, 2021
Well, kinda... this reconfigures my thumb `&mo` keys into a hold-tap:

  * Hold: Activate the layer (just like `&mo`)
  * Tap:  Send F24

When tapped, any active sticky keys are applied to the F24 keypress and
thus "cancelled". (Although the F24 keypress is sent to the host, it is
unlikely to be bound to anything in the applications I use.)

Unfortunately, this functionality clears sticky keys only when tapping
the key, it does not clear them when activating the layer (via hold).

Related ZMK GitHub thread:
zmkfirmware/zmk#834

This is an attempt to have one-shot functionality closer to Callum's:
https://github.com/callum-oakley/qmk_firmware/blob/master/users/callum/readme.md#oneshot-modifiers
@ldebritto
Copy link

Working around this I've faked a cancel function by creating a macro to trigger a F22 tap when hitting any of the thumb layer switches:

    macros {
        la_nav: cancel_queued_os_mods_and_toggle_nav {
            label = "LA_NAV";
            compatible = "zmk,behavior-macro";
            #binding-cells = <0>;
            bindings
                = <&macro_press &mo NAV>
                , <&macro_tap &kp F22>
                , <&macro_pause_for_release>
                , <&macro_release &mo NAV>
                ;
        };
        la_sym: cancel_queued_os_mods_and_toggle_sym {
            label = "LA_SYM";
            compatible = "zmk,behavior-macro";
            #binding-cells = <0>;
            bindings
                = <&macro_press &mo SYM>
                , <&macro_tap &kp F22>
                , <&macro_pause_for_release>
                , <&macro_release &mo SYM>
                ;
        };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants