desktop: maximized state lost when saved bounds exceed the display
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- electron, typescript
- 領域
- desktop
調査の方向性
packages/desktop/src/main/windows/window-state.tsを読み、resolveWindowState()とmanageWindowState.update()から確認します。within()がディスプレイより短い境界をどのように扱うか、またフォールバックが最大化と全画面のフラグをどのように保持するかを確認します。保存された通常時の境界より短いディスプレイ上で、最大化されたウィンドウが復元されれば完了です。利用可能であれば、ウィンドウ状態のテストで確認してください。
索引モデルが issue の本文から書いたものです。
説明
Description
On Linux/X11, the desktop app does not restore a maximized window on displays shorter than the default 800px window height (for example 1366×768). It opens unmaximized at the default size on every launch, even though it was closed maximized.
resolveWindowState() discards the entire saved state — including isMaximized — when the saved normal bounds do not fit inside a display. manageWindowState.update() intentionally leaves the normal bounds untouched while maximized, so those bounds can remain at the 1280×800 default (or WM-adjusted values taller than the screen). The state is therefore rejected on every restart, and the maximized flag never survives.
Environment
- OpenCode version: desktop app 2.1.3 (bundled CLI 2.1.3);
opencode --versionon PATH reports 2.1.0 - OS: CachyOS (Arch-based), Linux 7.2.11-1-cachyos, x86_64, XFCE 4.20 / xfwm4 4.20.0, X11
- Display: 1366×768; Electron reports bounds 1388×781 at scale 0.984375
- Terminal: Unavailable: desktop app, launched from the desktop/Plank entry
- Shell: /bin/fish
- Install/channel: Homebrew cask
opencode-desktop, latest (AppImage) - Plugins: none
Steps to reproduce
- Use a display whose height in Electron DIP is below 800 (e.g. 1366×768; Electron reports 1388×781 here).
- Launch the desktop app with a fresh profile (default window size is 1280×800).
- Maximize the window.
- Quit and relaunch the app.
Expected behavior
The window opens maximized again. If the saved normal bounds are unusable, the app may fall back to the default size but should still restore isMaximized / isFullScreen.
Actual behavior
The window opens unmaximized at 1280×800. This repeats on every launch. The state file stays invalid, so the maximized state is never restored; a workaround is to force maximize from outside after the window maps, which causes a visible resize.
Observed state before the workaround:
{"width":1284,"height":783,"x":2,"y":34,"displayBounds":{"x":0,"y":0,"width":1388,"height":781},"isMaximized":true,"isFullScreen":false}
y + height = 34 + 783 = 817 > 781, so within() fails.
Additional context
In packages/desktop/src/main/windows/window-state.ts (current main), the invalid-bounds fallback drops the maximize/fullscreen flags:
// resolveWindowState, lines 38-49
if (!state.displayBounds) return state
const visible = displays.all().some((bounds) => within(state, bounds))
if (visible) return state
return {
width: defaults.width,
height: defaults.height,
x: 0,
y: 0,
displayBounds: displays.primary(),
} satisfies WindowState
The fallback's own default bounds (1280×800) also do not fit a 768px-tall display. Meanwhile manageWindowState.update() (lines 80-89) skips updating x/y/width/height while maximized but still writes isMaximized and displayBounds, so the stale oversized normal bounds persist.
Suggested fix: keep isMaximized / isFullScreen in the fallback branch, clamp the restored bounds to the display, and/or avoid persisting stale normal bounds while maximized.
Related: #56970 (remember window position and size), #12413 (restoring maximized state, closed), #15165 (window state reset, closed).
Workaround used locally: remove displayBounds from the state file (then resolveWindowState returns the state as-is) and set valid bounds with isMaximized: true; the app then maximizes while the window is still hidden, before first paint.
- 主要言語
- TypeScript
- スター
- 215k
- フォーク
- 28.9k
- 平均マージ
- 4時間 21分
- マージ済み PR(30日)
- 476
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#58216 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
pending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#58181 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Opencde Github Actions Bot Cannot Install対応中かも @zzz-creator が 1 日前に担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#57911 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
anomalyco/opencode#57855 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
opencode.tools adds the execute / session_move hint even when Code Mode is denied対応中かも @Yun-0000 が 2 日前に担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
anomalyco/opencode#57711 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
メンテナーはふだん 1 日以内に返信
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)対応中かも @illya-havsiyevych が今日担当しました。 オープンbug
難易度 1/5 1〜3時間 初心者へのやさしさ 87/100
epam/ai-dial-chat#9566 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
はさみアイコンを修正するオープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
area: core
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信