Skip to content

fix(desktop): persist window size and restore macOS fullscreen exits cleanly#1170

Open
rushilrai wants to merge 3 commits intopingdotgg:mainfrom
rushilrai:main
Open

fix(desktop): persist window size and restore macOS fullscreen exits cleanly#1170
rushilrai wants to merge 3 commits intopingdotgg:mainfrom
rushilrai:main

Conversation

@rushilrai
Copy link

@rushilrai rushilrai commented Mar 17, 2026

What Changed

This PR makes the desktop app remember its last window state across relaunches.

It restores:

  • normal window size and position
  • maximized/fill-screen state
  • windows closed from macOS true fullscreen back onto the current desktop without the white startup flash

The restore logic keeps normal restore bounds separate from the fullscreen-origin visible frame so standard maximize behaviour stays intact.

Why

Right now the desktop app always comes back at the default size, which is frustrating if you keep it in a specific layout.
This change makes relaunch behavior feel much closer to what users expect from native desktop apps.

UI Changes

Desktop window restore behaviour only.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Persist window size and restore macOS fullscreen state across sessions

  • Adds windowState.ts with loadWindowState and attachWindowStatePersistence to save/restore window bounds and mode to userData/window-state.json.
  • On launch, restores the previous position, size, and restore mode (normal, maximized, or fullscreen-origin); falls back to a centered default (1100×780) if the saved state is missing, invalid, or off-screen.
  • Debounces resize/move persistence by 250ms; flushes immediately on maximize, fullscreen toggle, and close events.
  • On macOS, windows that were fullscreen before close are shown without re-entering fullscreen, using restoreMode: 'fullscreen-origin' to track this case.
  • Risk: first run or corrupted/off-screen state silently falls back to defaults with a console.warn.

Macroscope summarized 0272976.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7a218fce-7c33-4f42-8a75-b1e7a880a09e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.

OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant