[Bug]: Desktop window always reopens on the primary monitor, forgetting the display it was last used on
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
Requires two monitors.
- Launch the desktop app on a multi-monitor setup.
- Move the window to the secondary monitor.
- Maximize it there.
- Quit the app.
- Relaunch it.
Expected behavior
The window reopens maximized on the secondary monitor — the display it was last used on.
Actual behavior
The window reopens maximized on the primary monitor, every time. The monitor choice is never remembered across restarts.
The persisted state shows why. ~/.t3/userdata/desktop-settings.json after the steps above:
{"mainWindowBounds":{"x":410,"y":86,"width":1100,"height":780},"mainWindowMaximized":true}
mainWindowBounds stores the window's normal (pre-maximize) bounds, which here are the default centered position on monitor 1 — even though the window was maximized on monitor 2. Nothing in the persisted state identifies the display the window actually occupied.
On startup, resolveInitialMainWindowBounds in apps/desktop/src/window/DesktopWindow.ts picks a position from mainWindowBounds alone (accepting it if it fits any connected display), then maximize() is applied on ready-to-show. Since those bounds sit on monitor 1, the window maximizes on monitor 1.
The root cause is that normal bounds are not sufficient to identify a monitor: for a maximized window they are its last un-maximized geometry, which frequently points at a different display than the one it is on.
Impact
Minor bug or occasional failure
Version or commit
main @ 49c0d96ed
Environment
macOS 26.5.2 (Darwin 25.5.0), Node v24.18.0, two 4K displays both scaled to 1920x1080
Workaround
Manually drag the window back to the intended monitor after each launch.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/desktop/src/window/DesktopWindow.ts at resolveInitialMainWindowBounds and the ready-to-show maximize flow, then inspect how mainWindowBounds and mainWindowMaximized are persisted in ~/.t3/userdata/desktop-settings.json. Preserve enough display information for a maximized window to reopen on its last monitor, and verify the two-monitor reproduction relaunches maximized on the secondary display.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100