Repository navigation
Fix window position restore on relaunch - #2129
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
To use Codex here, create a Codex account and connect to github. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes improve window-frame restoration by introducing logic to preserve exact saved geometry when the window remains accessible across display configuration changes. A new accessibility check validates that the top portion of the saved frame stays sufficiently visible before returning the original frame, otherwise falling back to clamping behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes issue #2126 by stopping the unnecessary clamping of saved window frames when display geometry changes only slightly (e.g., dock or menu bar height adjusts by a few pixels). It inserts a new Key highlights:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[resolvedWindowFrame public entry] --> B{targetDisplay found?}
B -- Yes --> C{shouldPreserveExactFrame - same displayID and geometry unchanged}
C -- Yes --> D[Return frame as-is]
C -- No --> E[resolvedWindowFrame private inner]
E --> F{visibleFrame intersects frame?}
F -- Yes --> G{shouldPreserveAccessibleFrame - 120x24pt of top strip visible}
G -- Yes --> H[Return frame as-is - NEW]
G -- No --> I[clampFrame within visibleFrame]
F -- No --> J{displaySnapshot available?}
J -- Yes --> K[remappedFrame from saved to current display]
J -- No --> L[centeredFrame in targetDisplay]
B -- No --> M{Any display intersects frame?}
M -- Yes --> N[clampFrame within that display]
M -- No --> O[remap or center in fallbackDisplay]
Reviews (1): Last reviewed commit: "Merge branch 'main' of https://github.co..." | Re-trigger Greptile |
| standardizedFrame.height.isFinite, | ||
| standardizedFrame.width > 0, | ||
| standardizedFrame.height > 0, | ||
| standardizedFrame.intersects(targetDisplay.frame) else { |
There was a problem hiding this comment.
Guard checks
targetDisplay.frame instead of targetDisplay.visibleFrame
The outer resolvedWindowFrame call-site already guarantees targetDisplay.visibleFrame.intersects(frame) before reaching shouldPreserveAccessibleFrame. Because visibleFrame ⊆ frame in macOS, this guard is always true when called from the only existing call-site — so it never early-returns.
The actual risk-check that matters is whether the top strip sits inside the visibleFrame (line 3127), which is correctly implemented. The guard here provides no extra protection.
This isn't a runtime bug today, but if someone later calls shouldPreserveAccessibleFrame without the prior visible-frame intersection check, the guard will still pass for a frame that only touches the menu-bar/dock shadow areas (between frame and visibleFrame), and the subsequent topStrip.intersection(targetDisplay.visibleFrame) will correctly catch that case anyway.
Consider changing the guard to targetDisplay.visibleFrame to make the intent self-documenting:
| standardizedFrame.intersects(targetDisplay.frame) else { | |
| standardizedFrame.intersects(targetDisplay.visibleFrame) else { |
Ingests all upstream fixes since 2026-03-22 including: - Fix Cmd+N crash: retain snapshot workspaces (manaflow-ai#2183, manaflow-ai#2181, manaflow-ai#2178, manaflow-ai#2173) - Fix browser pane restore after reopen (manaflow-ai#2141) - Fix Ghostty resize_split keybind (manaflow-ai#1899) - Reduce shell integration prompt latency (manaflow-ai#2109) - Fix command palette focus after terminal find (manaflow-ai#2089) - Add Codex CLI hooks (manaflow-ai#2103) - Add cmux.json custom commands (manaflow-ai#2011) - Fix window position restore on relaunch (manaflow-ai#2129) Conflict resolution: - BrowserPanel.swift: accepted upstream configureWebViewConfiguration() refactor (already includes our forMainFrameOnly:true CAPTCHA fix from PR manaflow-ai#1877) Fork-specific files preserved: - Sources/Panels/WebAuthn{Coordinator,BridgeJavaScript}.swift - Sources/FIDO2/module.modulemap - vendor/ctap2 submodule - cmux.entitlements (with camera/audio-input removed) - cmux.embedded.entitlements - .github/workflows/fork-{ci,release}.yml
* test: cover accessible window frame restore * fix: preserve accessible window frame on relaunch
Summary
Testing
./scripts/reload.sh --tag issue-2126Demo Video
For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).
Review Trigger (Copy/Paste as PR comment)
Checklist
Summary by cubic
Restores the main window to the exact saved position on relaunch when it’s still reachable, improving behavior after small display/visible-frame changes. Fixes #2126.
Written for commit 8cf2e6f. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests