Repository navigation
Conversation
Mission Control does not change the frontmost application, so Rectangle's hotkeys kept firing and moved the last focused window behind the overview, stretching its thumbnail (rxhanson#1739). ShortcutManager now takes a missionControlActiveProvider, defaulting to the detector that rxhanson#1886 added for window animations, and drops requests whose source is .keyboardShortcut while it reports Mission Control, before anything downstream observes them. Mouse-button shortcuts and duplicate-shortcut cycles share that source and are covered; menu, URL, title-bar and drag-to-snap requests are unchanged, and a dropped request still runs its completion. Co-Authored-By: Claude Fable 5.1 <[email protected]>
AkiyamaKunka
marked this pull request as draft
October 19, 2026 16:10
AkiyamaKunka
marked this pull request as ready for review
October 20, 2026 19:57
AkiyamaKunka
marked this pull request as draft
October 23, 2026 03:05
AkiyamaKunka
marked this pull request as ready for review
October 23, 2026 03:31
Owner
|
Thanks! I think this should have a corresponding Defaults setting, as I can see Next/Prev display as still being beneficial to use while in Mission Control. I'm thinking the defaults setting can also be left off, since this issue is likely not too commonly hit, but I don't feel too strongly about it so I'd actually be fine either way. |
Gate the rxhanson#1739 guard behind a hidden default, ignoreShortcutsInMissionControl, defaulting to true (the current behavior). Users who prefer shortcuts to keep firing can opt out with: defaults write com.knollsoft.Rectangle ignoreShortcutsInMissionControl -bool false BoolDefault gains an optional defaultValue (matching DoubleDefault and the other Default types) so the toggle can default to true. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
|
Thanks! I've made this configurable via a hidden default instead of always-on.
|
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.
Closes #1739
While Mission Control is showing, Rectangle's shortcuts still fire and move the last focused window behind the overview, so its thumbnail stretches or jumps. In the issue you wrote that this "would be better fixed on Apple's side" and that you "don't have plans to implement this workaround myself, but see no reason to turn down a pull request for it." This is that pull request.
Why it happens
Mission Control is drawn by the Dock but does not make the Dock the frontmost application, so
NSWorkspace.shared.frontmostApplicationis still the app the user was in. The Carbon hotkeys keep firing,ShortcutManager.executehands the action toWindowManager, andWindowManagerresolves the front window via Accessibility and moves it. Nothing on the keyboard path knew about Mission Control.What this changes
ShortcutManagergets one more injectable provider,missionControlActiveProvider, next toappDisabledProvider. Its default is the Mission Control detector that #1886 added for window animations,WindowAnimationInterruptionPolicy.missionControlActive(anAXGroupchild of the Dock with identifiermc). At the top ofexecute(_:), a request whose source is.keyboardShortcutis dropped while that provider reports Mission Control, with a line in View Logging:Details:
windowActionWillExecuteis posted and beforeMultiWindowManager/TodoManagerrun, so nothing downstream observes an ignored shortcut; the existingdeferstill runs any completion the request carries. Duplicate-shortcut cycles and pointer-targeted mouse buttons still resolve their target window before reaching the guard, as they do today.ExecutionParameterswith the default.keyboardShortcutsource, so they are covered too.MASShortcutBinderbindings inTodoManager/StackBadgeManagerand are not gated here; the Move Todo left/right window actions are. Happy to add the same one-line guard to the Todo reflow binding if you would like it in this PR.WindowManager.swiftand the Isolate and improve optional window animations #1886 policy file are not modified;ExecutionSourceis only read.Cost
The detector is one Accessibility read of the Dock's children (with the existing 0.05 s messaging timeout on the Dock element) plus a role/identifier read per child. On macOS 27.0.1 it took about 1–3 ms per call once warm (the very first call in a fresh process took ~48 ms while the Accessibility connection to the Dock was established). The keyboard path already performs several Accessibility reads per shortcut to find the front window, so this fits the existing cost profile.
Verified on macOS 27.0.1 (26A434)
A standalone script evaluating the same query as the detector, with the Dock's Accessibility children dumped:
AXListfalsetell application "Mission Control" to launchAXList,AXGroupidmctitle "Mission Control"trueAXListfalseThe frontmost application stayed the same (Finder) throughout, which is exactly why the hotkeys kept firing.
Tests
Four new cases in
ShortcutManagerSessionTests, using the existing provider injection andCapturingWindowManager:windowActionWillExecute;Full
RectangleTestssuite: 606 tests, 0 failures, on macOS 27.0.1 / Xcode 27.