Restore windows to their macOS Spaces without switching Spaces - #6
Open
jeanmonet wants to merge 7 commits into
Open
Restore windows to their macOS Spaces without switching Spaces#6jeanmonet wants to merge 7 commits into
jeanmonet wants to merge 7 commits into
Conversation
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
Signed-off-by: jeanmonet <15112920+jeanmonet@users.noreply.github.com>
jeanmonet
force-pushed
the
codex/native-space-restoration-tahoe
branch
from
August 28, 2026 15:41
16ccacc to
7e7082d
Compare
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.
Dependency
Depends on #5 and should be merged after it. Until then, GitHub's diff against
mainalso contains #5's scratchpad/session work; after #5 lands, this PR reduces to the six Space-restoration commits from2068df2through7e7082d.Both branches are rebased onto upstream v0.5.1.
Summary
Implementation notes
macOS exposes no supported API for assigning a window to a specific Space. This implementation therefore isolates the necessary private WindowServer/SkyLight calls in
MarginPrivateSupport, verifies every move, and enables that backend only on macOS 26. The adapted yabai code is credited inNOTICE.Cold launch starts as an accessory application and becomes a regular foreground app only after a current-Space window is prepared. Remote restored windows are ordered without activation, preventing Launch Services or AppKit from pulling the user into another Space.
Once Margin is running, it does not observe active-Space changes. AppKit's explicit
applicationShouldHandleReopendelegate path is the only running-app event that may surface a window. This deliberately removes the previous transparent key-window prearming workaround, which could race a user's click into another app and steal focus 100 ms after a Space transition. Launch Services activates a running app before delivering its reopen event, so guaranteed current-Space Dock reopening would require persistent hidden preactivation window machinery; this PR instead follows native macOS activation behavior.Verification
git range-diffreports all six Space-restoration commits unchangedmake smoke— passed on exact rebased head7e7082d; bundle, CLI, document inspection/comparison, and app-window launch checks passedmake benchmark-matrix— passed all five cases on exact rebased head; worst visible-window p95 was 440.371 ms against 500 ms, and worst target-ready p95 was 1,145.982 ms against 1,250 msmake check-version— passed at 0.5.1 (11)git diff --check— passedmake test— unavailable locally because the machine has Command Line Tools rather than full Xcode/XCTest; focused test coverage for the surrounding Space/session policy remains in the branchRelease handling
The upstream base is now v0.5.1 (app version 0.5.1, build 11). This PR intentionally does not invent a second version bump: it adds its user-facing note under Unreleased, and the maintainer can choose the next release version after deciding the merged release contents. Given the feature scope, that may be 0.6.0 rather than another patch version.
Compatibility and safety