Add --ignore-injected-events flag to support key remappers (e.g. kanata)#66
Open
MattKotsenas wants to merge 2 commits into
Open
Add --ignore-injected-events flag to support key remappers (e.g. kanata)#66MattKotsenas wants to merge 2 commits into
MattKotsenas wants to merge 2 commits into
Conversation
Users of key remappers (e.g. kanata) need to know when mousemaster's low-level keyboard hook is installed so they can order their own hook after it. The message was previously logged at TRACE, which in practice requires DEBUG-or-lower logging that also logs every keystroke. Logging it at INFO exposes the readiness signal without that.
MattKotsenas
added a commit
to MattKotsenas/dotfiles
that referenced
this pull request
Jul 2, 2026
…tic hook order kanata maps CAP + backtick to a one-shot F13, and mousemaster activates on F13. mousemaster only sees kanata's output (emitted via SendInput, so flagged injected) because its wpm unit now runs --ignore-injected-events=false, a flag added in the fork build (petoncle/mousemaster#66); the DSC download points at that fork release until the flag ships upstream. leftalt+i is kept as a physical activation fallback, and mousemaster's exit is unified on esc (the q/p exit alias was ambiguous with hint keys). Both kanata and mousemaster install WH_KEYBOARD_LL hooks, whose call order (last installed is called first) is nondeterministic and not queryable from any process. kanata.toml now Requires mousemaster, and mousemaster.toml gates readiness on a Command healthcheck (wpm/mousemaster-hook-ready.ps1) that waits for mousemaster to log "Installed keyboard hook successfully". wpm blocks a dependent until its dependency's healthcheck passes, so kanata always starts after mousemaster's hook is up: kanata's hook is newest, runs first, and converts the physical backtick to F13 before mousemaster sees it. mousemaster runs with --log-level=info (exposes the hook-ready line without logging every keystroke) and --pause-on-error=false plus ExecStart RetryLimit=1 (a failed start otherwise hangs on the single-instance lock and cascades into repeated respawns). It is no longer Autostart; kanata pulls it in as a dependency.
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
Adds the
--ignore-injected-eventscommand-line flag (originally prototyped by @petoncle, see #39) on top of currentmain.mousemaster ignores injected keyboard events (
LLKHF_INJECTED) by default, so key events produced by remapping software such as kanata (which emits viaSendInputand is therefore flagged injected) never reach mode/combo processing. That makes it impossible to activate or drive mousemaster from those tools.This flag lets users opt in to processing injected events:
true, so behavior is unchanged for anyone who doesn't set it.=false, injected key events flow through the normal keyboard path.Testing
Built and verified locally on Windows with Oracle GraalVM JDK 21 + MSVC (VS 2022) with a minimal config that activates on a single key; verified via the
ComboWatcherdebug log.I'm also happy to add automated tests here; if you have any preferences, please let me know!
Notes