fix: don't intercept all devices when include/exclude list has no matches#1986
Merged
jtroo merged 1 commit intojtroo:mainfrom Mar 22, 2026
Merged
Conversation
…ches
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 instead of silently grabbing
everything.
Fixes jtroo#1479
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
malpern
added a commit
to malpern/kanata
that referenced
this pull request
Mar 21, 2026
Add macOS equivalent of linux-continue-if-no-devs-found. When enabled, kanata keeps running if no matching devices are found at startup and automatically captures them when they connect, using driverkit's IOKit notification system. This also includes the fix from PR jtroo#1986 (don't fall back to grabbing all devices when an include/exclude list has no matches). Depends on psych3r/driverkit#17 for notification subscription support for not-yet-connected devices. Relates to jtroo#1479 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
malpern
added a commit
to malpern/kanata
that referenced
this pull request
Mar 21, 2026
Add macOS equivalent of linux-continue-if-no-devs-found. When enabled, kanata keeps running if no matching devices are found at startup and automatically captures them when they connect, using driverkit's IOKit notification system. This also includes the fix from PR jtroo#1986 (don't fall back to grabbing all devices when an include/exclude list has no matches). Depends on psych3r/driverkit#17 for notification subscription support for not-yet-connected devices. Relates to jtroo#1479 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
malpern
added a commit
to malpern/kanata
that referenced
this pull request
Mar 21, 2026
Add macOS equivalent of linux-continue-if-no-devs-found. When enabled, kanata keeps running if no matching devices are found at startup and automatically captures them when they connect, using driverkit's IOKit notification system. This also includes the fix from PR jtroo#1986 (don't fall back to grabbing all devices when an include/exclude list has no matches). Depends on psych3r/driverkit#17 for notification subscription support for not-yet-connected devices. Relates to jtroo#1479 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jtroo
approved these changes
Mar 22, 2026
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
macos-dev-names-includeormacos-dev-names-excludeis configured but no connected devices match, kanata was falling back toregister_device("")which intercepts all devicesFixes #1479
Test plan
macos-dev-names-includewith a nonexistent device name — kanata now errors out instead of grabbing all devicesmacos-dev-names-includewith a real connected device — kanata correctly grabs only that device and remapping worksPossible follow-up
Linux has
linux-continue-if-no-devs-foundwhich lets kanata wait for devices instead of exiting. A cross-platformcontinue-if-no-devs-foundoption could be added to support the multi-instance use case where kanata should stay running and pick up the device when it connects.