Add Speculative Hold to zsa/qmk_firmware. #422
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.
Adds the new Speculative Hold tap-hold option to zsa/qmk_firmware.
Description
This is a cherry pick of qmk#25125 + qmk#25797. Speculative Hold makes mod-tap keys more responsive by applying the modifier instantly on keydown, before the tap-hold decision is made. This is especially useful for actions like Shift+click and Ctrl+scroll wheel with an external mouse, which can feel laggy with standard mod-taps.
The firmware holds the modifier speculatively. Once the key's behavior is settled:
Speculative Hold applies the modifier early but does not change the underlying tap-hold decision logic. Speculative Hold is compatible to use in combination with any other tap-hold options.
Using Speculative Hold
To enable Speculative Hold, add
#define SPECULATIVE_HOLDin config.h, or in keyboard.json setconfig.tapping.speculative_holdtotrue.By default, Speculative Hold is enabled only for Shift, Ctrl, and Ctrl+Shift mod-taps. It is possible to customize which keys it is enabled on with
get_speculative_hold(), for instance:A technicality is that some mods, such as GUI, may be bound to application actions when pressed by themselves, and Speculative Hold may falsely trigger such hotkeys, and this is of course OS and application dependent. Define
DUMMY_MOD_NEUTRALIZER_KEYCODE(and optionallyMODS_TO_NEUTRALIZE) in yourconfig.hto prevent this as described here.Types of Changes
Checklist