-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
Kanata can only select devices at startup (macos-dev-names-*, linux-dev-names-*). Within a single process there’s no way to target or exclude specific keyboards inside rules (layers, overrides, aliases, etc.). Users want Karabiner-style per-device behavior (e.g., external board uses layer X, built-in uses layer Y) without running multiple Kanata instances.
Goal / Outcome
Provide a device-aware predicate that can be used in switch and (over time) other action contexts, so config authors can scope rules to specific keyboards by name/hash/path.
Scope
- Expose device metadata on events (macOS DriverKit product name/hash; Linux evdev name/path; Windows optional/TBD).
- Add a device-matching predicate (
device?,if-device, orswitch-device) usable inswitch(v1) and extendable to other constructs (e.g., conditionals, overrides). - Keep feature opt-in; default configs unchanged.
- Docs + samples showing include/exclude patterns and fallbacks.
- Tests: parser + runtime with macOS DriverKit stub and Linux evdev mock.
Acceptance Criteria
- A single Kanata process can apply different layers/actions based on the originating keyboard.
- Clear errors/warnings when a referenced device isn’t present.
- No measurable perf regression in the hot path (device lookup O(1)).
Notes
- Upstream issue: Feature request: device name based logic on
switchfunc jtroo/kanata#1777 (device name based logic on switch func) — "PRs welcome". - Device name stability is limited; allow hash/path fallback.
- Windows support is optional; don’t block the MVP.
Metadata
Metadata
Assignees
Labels
No labels