feat: thread device identity for per-device switch conditions#1973
Closed
malpern wants to merge 5 commits intojtroo:mainfrom
Closed
feat: thread device identity for per-device switch conditions#1973malpern wants to merge 5 commits intojtroo:mainfrom
malpern wants to merge 5 commits intojtroo:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…itch conditions Add device_index to KeyEvent and thread it from Linux KbdIn through to keyberon's switch evaluation. On Linux, each registered input device gets a monotonically increasing u8 index. This enables a new `(device N)` switch condition that matches events from a specific device. Data flow: KbdIn assigns device indices at registration time, pairs each InputEvent with its device index in read(), the event loop enriches KeyEvent via with_device(), handle_input_event sets Layout.current_device, and switch evaluation checks OpCodeType::Device against current_device. macOS/Windows default to device_index=0 (no multi-device support yet). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b21123c to
0c46590
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes build failures on Windows, Linux (no-features), Android, and simulated/test targets where KeyEvent struct literals were missing the new device_index field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… too_many_arguments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Closing — opened prematurely against upstream. Will validate locally in KeyPath integration before upstreaming. |
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.
Summary
device_index: u8field toKeyEvent, threaded from LinuxKbdInthrough to keyberon switch evaluation(device N)switch condition in the parser that matches events from a specific physical devicecurrent_device: Option<u8>onLayout(not in keyberon Event row) to preserve the row 0/1 real/virtual key invariantdevice_index: 0default (no multi-device support yet)Data Flow
Usage Example
Not in scope (follow-up PRs)
(device "Kinesis")/(defdevice ...)configTest plan
cargo buildsucceedsdevice_opcode_encoding_roundtrip,device_evaluate_boolean_matches,device_evaluate_boolean_with_and(device N)switch conditions🤖 Generated with Claude Code