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: input processor behavior invocation #2714

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Dec 15, 2024

Adds a new input processor that can trigger behaviors for certain input events.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.

Allow input processors to return a special value if a given input event
should not be further processed/propagated.
@petejohanson petejohanson added enhancement New feature or request pointers Pointer related functionality labels Dec 15, 2024
@petejohanson petejohanson self-assigned this Dec 15, 2024
@Nick-Munnich
Copy link
Contributor

I'm immediately curious about the complex behavior/hold-tap limitations. Could you elaborate a bit?

@petejohanson
Copy link
Contributor Author

I'm immediately curious about the complex behavior/hold-tap limitations. Could you elaborate a bit?

Those behaviors rely on tracking things based on the key position, which isn't part of the binding event details when there's no associated key position for this. This PR is still a draft because I'm next working on a "event to key position event mapper" processor that will allow certain input events to generate key position events, i.e. "key presses", to trigger keymap processing like normal, for folks interested in extending they keymaps to allow more complex behaviors.

@Nick-Munnich
Copy link
Contributor

This PR is still a draft because I'm next working on a "event to key position event mapper" processor that will allow certain input events to generate key position events [...]

I recall a brief discussion on Discord a while ago where I suggested a (pair of) behavior to trigger behaviors from specific locations in the keymap, "Trigger the behavior found at my current index on this layer", "trigger the behavior found on layer X at index X". Though another processor is probably a cleaner way of resolving the issue, but as a backup/if you like the idea.

@petejohanson
Copy link
Contributor Author

This PR is still a draft because I'm next working on a "event to key position event mapper" processor that will allow certain input events to generate key position events [...]

I recall a brief discussion on Discord a while ago where I suggested a (pair of) behavior to trigger behaviors from specific locations in the keymap, "Trigger the behavior found at my current index on this layer", "trigger the behavior found on layer X at index X". Though another processor is probably a cleaner way of resolving the issue, but as a backup/if you like the idea.

I want the processor to honor whatever layers are active though, so folks can combine the processor with various layer settings for effect.

@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch 2 times, most recently from 90b2d71 to ecd720c Compare December 16, 2024 01:43
@petejohanson
Copy link
Contributor Author

@Nick-Munnich Ok, I went with extending the virtual key positions to support this more extensively, and remove that limitation. I've removed that note, and added a test showing the use with hold tap.

@petejohanson petejohanson marked this pull request as ready for review December 16, 2024 01:48
@petejohanson petejohanson requested review from a team as code owners December 16, 2024 01:48
@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch from 947a15c to 64c4ba5 Compare December 16, 2024 02:19
@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch from 04c4c7b to 43539c4 Compare December 16, 2024 21:19
@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch 3 times, most recently from 6455e4f to abd69da Compare December 16, 2024 23:39
@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch 2 times, most recently from 76050dd to 221524c Compare December 16, 2024 23:56
Add the ability to intercept certain input events and trigger behaviors
when they occur.

Co-authored-by: Jorge Villalobos <minusfive@users.noreply.github.com>
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
@petejohanson petejohanson force-pushed the pointing/processor-behavior-invocation branch from 221524c to c3c9c56 Compare December 18, 2024 01:30
@petejohanson petejohanson merged commit cb867f9 into zmkfirmware:main Dec 18, 2024
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pointers Pointer related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants