Commit fc5d709
fix(macos): don't intercept all devices when include/exclude list has no matches (#1986)
## Summary
- When `macos-dev-names-include` or `macos-dev-names-exclude` is
configured but no connected devices match, kanata was falling back to
`register_device("")` which intercepts **all** devices
- This caused kanata to grab the wrong keyboard (e.g., the internal
MacBook keyboard when an external keyboard was specified but not
connected)
- Now kanata only falls back to the catch-all registration when no
device filter is configured at all — when a filter is present but
nothing matches, kanata exits with an error
Fixes #1479
## Test plan
- [x] Configured `macos-dev-names-include` with a nonexistent device
name — kanata now errors out instead of grabbing all devices
- [x] Configured `macos-dev-names-include` with a real connected device
— kanata correctly grabs only that device and remapping works
- [x] No include/exclude list — default behavior unchanged (grabs all
devices)
## Possible follow-up
Linux has `linux-continue-if-no-devs-found` which lets kanata wait for
devices instead of exiting. A cross-platform `continue-if-no-devs-found`
option could be added to support the multi-instance use case where
kanata should stay running and pick up the device when it connects.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 3bda1ec commit fc5d709
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| |||
0 commit comments