-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
bugfix: sticky keys held for longer than release-after-ms
get stuck
#1636
base: main
Are you sure you want to change the base?
Conversation
Sticky keys work to modify the next keypress, but also have utility in being held to achieve certain behaviours such as making multiple selections with a mouse. The current implementation of sticky keys does not account for the case where a sticky key is held longer than `release-after-ms`. In this case, the sticky key gets stuck. This PR proposes releasing the sticky key 1ms after the key is released if `release-after-ms` has lapsed during the hold, so that the sticky key behaves like a momentary key for long holds. I have tested this for the past few days and have found it fixes my use cases.
Thanks for the PR! This should have an extra unit test added to verify this behavior change works as expected for the new functionality. Please add a new test to cover this. Thanks! |
This feature (or fix) should be called release-after-hold. I am not sure whether it should be classified as a fix or a feature. Personally, I consider it a bug that needs fixing because I cannot think of any use case for persisting a key press after holding the key. The fact that no one has ever complained about this for years is questionable. Perhaps some people rely on this behavior, or there may be some use cases that I am unaware of. Should we create a poll? Here is the current sticky key behavior:
The feature (or fix) starts the timer on
You did not include this change in your pull request, or perhaps I misunderstood what you meant? Here's a unit test for release-after-hold. |
Either there was a breaking change in main or the code wasn't properly tested, because this patch doesn't seem to work for me. I think the problem is that zmk/app/src/behaviors/behavior_sticky_key.c Lines 165 to 172 in e7a6e40
The code there actually confuses me. I am unsure how it is functionally different from just calling To properly implement the feature, I had to move the timer start code to behaviour pressed, and then I made it release the behavior directly on behaviour released instead of scheduling a 1ms delay: |
I think I understand the code now. It was not actually designed to represent the "time left on the timer", instead it was to correct an edge case where you release the physical key but for some reason there is a delay until it processes the behavior release. Perhaps the original PR was actually just fixing a small bug where it won't release the behavior if the time remaining is negative for some reason, but not actually implementing the feature where it will start timing on keypress. |
The implementation in #1788 will also fix this. Can you try it out? |
Sticky keys work to modify the next keypress, but also have utility in being held to achieve certain behaviours such as making multiple selections with a mouse. The current implementation of sticky keys does not account for the case where a sticky key is held longer than
release-after-ms
. In this case, the sticky key gets stuck.This PR proposes releasing the sticky key 1ms after the key is released if
release-after-ms
has lapsed during the hold, so that the sticky key behaves like a momentary key for long holds.I have tested this for the past few days and have found it fixes my use cases.
Board/Shield Check-list
.zmk.yml
metadata file added&pro_micro
used in favor of&pro_micro_d/a
if applicable.conf
file has optional extra features commented out