Repository navigation
maple-agent: remember the main window position - #1270
Merged
Merged
Conversation
Save the window origin and the display's UUID with the saved size. When the store opens, macOS moves the window to that frame in one AppKit change. If the display is gone, the window stays centered. The pinned GPUI can only position a window when it opens one, and settings arrive after the window is open. On Linux and Windows the startup window therefore still restores size only. A window reopened from the tray uses the saved position through GPUI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Maple Work now reopens where it was last left on macOS. Before this change it saved only the window size and maximized state, and always opened centered.
Why position needs native code
cc053a4a) can position a window only when it opens one. It hasresize, but no move.Changes
WindowStategainsposition { x, y, display }. The display is GPUI's persistent display UUID. Older saved state without a position still parses.desktop/native_window.rsapplies the saved size and position in one AppKitsetFrame.constrainFrameRect:toScreen:keeps the title bar on screen.resizedoes. Called synchronously insidewindow.update, AppKit's move and resize callbacks hit a borrowed window and GPUI loggedRefCell already borrowed.window_bounds+display_id.raw-window-handleis added as a direct macOS dependency to reach the NSWindow. It was already in the lockfile through GPUI.Verification (macOS VM, isolated XDG profile)
cua-driver set_window_frameto (20, 60) 1000×700, chose Quit, relaunched. The window reopened at exactly (20, 60) 1000×700, and a screenshot showed the content laid out at the new size.just clippypasses for all feature sets, the desktop/settings tests pass, and the pre-commit hook is green.Not tested:
Known limitation
On macOS the window still visibly moves from the centered default to its saved frame once the store opens, as the size restore already did. Removing that jump means opening the main window after the store is ready, which is store design decision #36 and a larger startup change.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.