You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
desktop: remember window position and size across restarts #56970
The OpenCode desktop app on Windows does not remember the window position or
size between restarts. Users must move/resize the window after every relaunch.
Environment
opencode version: 2.0.26 (desktop app, latest)
OS: Windows_NT 10.0.19045 (win32 x64)
Terminal: Unavailable: desktop app, not run from a terminal
Shell: C:\Windows\system32\cmd.exe
Install/channel: latest
Active plugins: none (global opencode.jsonc contains only $schema)
Reproduction
Launch the OpenCode desktop app.
Move and resize the window (e.g., free-form size or maximize).
Close the app.
Launch the app again.
Expected Behavior
The app reopens at the last-used window position and size (and remembers the
maximized/restored state).
Actual Behavior
The window reopens at a default position and default size; adjusted geometry
is lost.
Additional Context
Reproducible consistently.
No in-app setting exists, and the V2 docs (cli.json, opencode.json(c))
have no window-geometry option — currently a feature request.
Workaround: keep the window maximized.
Suggestion: persist window bounds on close and restore on next launch,
optionally with a "remember window geometry" toggle in desktop settings.
Thanks for the detailed report. The desktop app is supposed to remember the window position, size and maximized state between launches, so this looks like a bug rather than a missing feature.
I couldn't run the Windows desktop app here, but I tested the code that restores the saved window position. It only reuses the saved position if the whole window fits inside a display. Windows reports a window snapped to the screen edge a few pixels off-screen (e.g. x = -7) because of its invisible borders. When I gave it a saved position like that, it threw the position away and used the default 1280×800 window instead. That would explain the problem for snapped or edge-aligned windows.
To help a maintainer with a Windows machine narrow it down, could you say:
Does it also happen when the window is placed freely in the middle of the screen, not snapped or touching an edge?
Do you use more than one monitor, or display scaling other than 100%?
After you close the app, is there a window-state-*.json file in %APPDATA%\OpenCode (or the app's userData folder), and what does it contain?
Related: #47534 (window position/size not restored on multi-monitor setups, reported on the older Tauri-based app).
I would like to take this. The edge-snapped case looks reproducible with a unit test around within() in window-state.ts: Windows reports the window a few pixels off-screen, so the full-containment check falls back to defaults. I will add a small tolerance for those borders and cover both snapped and genuinely off-screen cases. Should I target dev?
I installed 2.0.32 on a Windows 11 machine and tried snapping, free-moving, and maximizing the window. All three restored correctly, and the saved bounds were normalized (x=1 for the snapped window, x=307 for the free one), not negative. I could not reproduce the Windows 10 report here.
I opened #57088 as a defensive fix for the negative-bounds path. If you are still on Windows 10, could you share your window-state-*.json or retest on 2.0.32?
Activity
opencode-agent commentedon Oct 19, 2026
Thanks for the detailed report. The desktop app is supposed to remember the window position, size and maximized state between launches, so this looks like a bug rather than a missing feature.
I couldn't run the Windows desktop app here, but I tested the code that restores the saved window position. It only reuses the saved position if the whole window fits inside a display. Windows reports a window snapped to the screen edge a few pixels off-screen (e.g. x = -7) because of its invisible borders. When I gave it a saved position like that, it threw the position away and used the default 1280×800 window instead. That would explain the problem for snapped or edge-aligned windows.
To help a maintainer with a Windows machine narrow it down, could you say:
window-state-*.jsonfile in%APPDATA%\OpenCode(or the app's userData folder), and what does it contain?Related: #47534 (window position/size not restored on multi-monitor setups, reported on the older Tauri-based app).
LeON-Nie-code commentedon Oct 19, 2026
I would like to take this. The edge-snapped case looks reproducible with a unit test around
within()inwindow-state.ts: Windows reports the window a few pixels off-screen, so the full-containment check falls back to defaults. I will add a small tolerance for those borders and cover both snapped and genuinely off-screen cases. Should I targetdev?LeON-Nie-code commentedon Oct 19, 2026
I installed 2.0.32 on a Windows 11 machine and tried snapping, free-moving, and maximizing the window. All three restored correctly, and the saved bounds were normalized (x=1 for the snapped window, x=307 for the free one), not negative. I could not reproduce the Windows 10 report here.
I opened #57088 as a defensive fix for the negative-bounds path. If you are still on Windows 10, could you share your
window-state-*.jsonor retest on 2.0.32?