🐞 Fix stale isLoopOpen check causing action keys to leak to focused app#1096
Merged
Merged
Conversation
In KeybindTrigger.performKeybind, the normal (non-bypassed) keybind
branch returned a consume/opening decision based on the isLoopOpen
value captured at the top of the function, *before* the openLoop()
call on the preceding line had a chance to update Loop's state. When
the trigger key and action key are pressed in rapid succession, this
loses the race and returns .opening, which forwards the action key
to the frontmost app.
The bypassed-action branch 16 lines below already uses the fresh
checkIfLoopOpen() for the same return decision. The inline comment
on lines 193-194 documents the intent ("Only consume the event if
the last command actually opened Loop") which the fresh check
honors and the stale check contradicts.
mrkai77
approved these changes
May 11, 2026
Owner
mrkai77
left a comment
There was a problem hiding this comment.
Thank you! For future PRs, please use our PR template instead of creating your own. Since this is a relatively small change, though, I’ll go ahead and merge it :)
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
In
KeybindTrigger.performKeybind, the normal (non-bypassed) keybind branch returns its consume/opening decision based on theisLoopOpenvalue captured at the top of the function — i.e. beforeopenLoop()ran. When Loop's open-state hasn't propagated by the moment that stale value is read (easy to lose when the trigger key and action key are pressed in rapid succession), the function returns.openingand the caller forwards the action key to the frontmost app.The symmetric bypassed-action branch 16 lines below already uses
checkIfLoopOpen()(fresh check) for the same return decision, and the inline comment immediately above the affected line documents the intent:The stale check contradicts that comment; the fresh check honors it. This appears to be an oversight in the non-bypassed branch.
Change
One line in
Loop/Core/Observers/KeybindTrigger.swift:Symptom this fixes
When holding the trigger key and pressing an action key (e.g. Globe + W bound to Maximize), the action runs but the action key also reaches the focused app, triggering unwanted typing or app shortcuts. Reproducible on macOS 26.3 against the current
developbranch.Verification
With the patch applied, action chords cleanly resize the window without leaking the action key. Bypassed actions continue to work as before (they already used the fresh check). No other behavior change.
I'm running a locally built copy of
developwith this single-line fix and have verified the leak is gone in TextEdit and a few other apps.