-
Notifications
You must be signed in to change notification settings - Fork 2
tap-hold pending_output (speculative Hold) #709
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b1edee
core: add System::pending_output hook
rgoulter 0535a31
core: tap-hold pending_output profile and hold_output
rgoulter 4231b30
ncl: tap-hold pending_output authoring and codegen
rgoulter 6280def
test: refresh expected.rs snapshots for pending_output
rgoulter eda5dff
test: add pending_output integration tests
rgoulter 7e19795
test: add pending_output cucumber feature
rgoulter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
features/keymap/key/tap_hold-config-pending_output.feature
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| Feature: TapHold Key (configure pending_output) | ||
|
|
||
| The `pending_output` config for tap-hold keys controls speculative HID | ||
| while the tap-vs-hold decision is still pending. | ||
|
|
||
| Default `NoOutput` produces no output while pending. | ||
| No HID is emitted until timeout, interrupt, or release settles tap vs hold. | ||
| `Hold` emits the hold binding's HID while still pending, then keeps it | ||
| or retracts it when tap vs hold settles. Decision logic is unchanged. | ||
| Only the timing of hold appearance changes. | ||
|
|
||
| This matches FAK `eager_decision = 'hold'`, ZMK | ||
| `hold-while-undecided`, and QMK Speculative Hold. | ||
|
|
||
| For examples of this key in other smart keyboard firmware, see e.g.: | ||
|
|
||
| - [FAK's eager_decision](https://github.com/semickolon/fak) | ||
|
|
||
| - [ZMK's hold-while-undecided](https://zmk.dev/docs/keymaps/behaviors/hold-tap#hold-while-undecided) | ||
|
|
||
| - [QMK's Speculative Hold](https://docs.qmk.fm/tap_hold#speculative-hold) | ||
|
|
||
| Background: | ||
|
|
||
| Given a keymap.ncl: | ||
| """ | ||
| let K = import "keys.ncl" in | ||
| { | ||
| config.tap_hold.pending_output = "Hold", | ||
| keys = [ | ||
| K.A & K.hold K.LeftCtrl, | ||
| K.B | ||
| ] | ||
| } | ||
| """ | ||
|
|
||
| Example: Hold with timeout shows mod from first tick and stays hold | ||
|
|
||
| When the keymap registers the following input | ||
| """ | ||
| [ | ||
| press (K.A & K.hold K.LeftCtrl), | ||
| wait 1, | ||
| ] | ||
| """ | ||
| Then the HID keyboard report should equal | ||
| """ | ||
| { modifiers = { left_ctrl = true } } | ||
| """ | ||
|
|
||
| Example: Hold with quick release retracts mod and ends as tap | ||
|
|
||
| When the keymap registers the following input | ||
| """ | ||
| [ | ||
| press (K.A & K.hold K.LeftCtrl), | ||
| wait 1, | ||
| release (K.A & K.hold K.LeftCtrl), | ||
| ] | ||
| """ | ||
| Then the HID keyboard report should equal | ||
| """ | ||
| { key_codes = [K.A] } | ||
| """ | ||
|
|
||
| Example: Hold with HoldOnKeyPress interrupt shows mod already down when other key taps | ||
|
|
||
| Given a keymap.ncl: | ||
| """ | ||
| let K = import "keys.ncl" in | ||
| { | ||
| config.tap_hold.pending_output = "Hold", | ||
| config.tap_hold.interrupt_response = "HoldOnKeyPress", | ||
| keys = [ | ||
| K.A & K.hold K.LeftCtrl, | ||
| K.B | ||
| ] | ||
| } | ||
| """ | ||
| When the keymap registers the following input | ||
| """ | ||
| [ | ||
| press (K.A & K.hold K.LeftCtrl), | ||
| wait 1, | ||
| tap K.B, | ||
| ] | ||
| """ | ||
| Then the HID keyboard report should equal | ||
| """ | ||
| { modifiers = { left_ctrl = true }, key_codes = [K.B] } | ||
| """ |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use hex values, or otherwise comment this so it's clearer / easier to cross reference.