[Core] Options to constrain Speculative Hold: SPECULATIVE_HOLD_ONE_KEY and SPECULATIVE_HOLD_FLOW_TERM.#26099
Open
getreuer wants to merge 4 commits intoqmk:developfrom
Open
[Core] Options to constrain Speculative Hold: SPECULATIVE_HOLD_ONE_KEY and SPECULATIVE_HOLD_FLOW_TERM.#26099getreuer wants to merge 4 commits intoqmk:developfrom
SPECULATIVE_HOLD_ONE_KEY and SPECULATIVE_HOLD_FLOW_TERM.#26099getreuer wants to merge 4 commits intoqmk:developfrom
Conversation
drashna
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To curb "flashing mods" problems, this PR implements two new options,
SPECULATIVE_HOLD_ONE_KEYandSPECULATIVE_HOLD_FLOW_TERM, to constrain when Speculative Hold may apply.Description
In some conditions, Speculative Hold will press and then release a modifier without pressing any other key while it is held, and the OS or application might react to this (aka the "flashing mods" problem). How such an input is handled depends on the OS and application, so unfortunately, there is no universal solution. Using DUMMY_MOD_NEUTRALIZER_KEYCODE is a good mitigation, but not a full solution.
This PR adds two options that limit when Speculative Hold may apply. Depending on the user's scenario, these may fix cases where flashing mods would confuse and break an important hotkey.
SPECULATIVE_HOLD_ONE_KEY
This option constrains Speculative Hold to one key at a time. Enable by adding in config.h:
With this option, speculation does not apply when any mods are already active. Mod combinations across multiple keys can still be made after settling. This option would fix #26061, where Speculative Hold breaks certain "mod+key" hotkeys in Blender.
SPECULATIVE_HOLD_FLOW_TERM
This option disables Speculative Hold during the flow of fast typing. Add in config.h:
Speculative Hold does not apply if a key is pressed within this threshold of the previous key. The effect is similar to Flow Tap; however,
SPECULATIVE_HOLD_FLOW_TERMonly restricts when speculation is allowed, without affecting how the key settles. This option would fix where speculation breaks Zed editor leader key hotkeys, an example as noted in getreuer/qmk-modules#15.Rationale
The intention with both of these options is that they yet allow speculation in isolated "mod + mouse" inputs, since that's the motivating use case for Speculative Hold. In hindsight, I wish
SPECULATIVE_HOLD_ONE_KEY+SPECULATIVE_HOLD_FLOW_TERMwas default behavior.Implementation notes
speculative_key_press()function in action_tapping.c. This is where the logic lives that determines when Speculative Hold is allowed to apply.SPECULATIVE_HOLD_FLOW_TERMreuses Flow Tap's tracking of the previous key time, done through ifdef'ing the needed parts.Types of Changes
Issues Fixed or Closed by This PR
Checklist