Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

desktop: maximized state lost when saved bounds exceed the display

オープン 初心者向け
#58,247 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@tneemo がすでに取り組んでいます。

2026年10月23日 から。

  • #58442 @tneemo による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
electron, typescript
領域
desktop

調査の方向性

packages/desktop/src/main/windows/window-state.tsを読み、resolveWindowState()とmanageWindowState.update()から確認します。within()がディスプレイより短い境界をどのように扱うか、またフォールバックが最大化と全画面のフラグをどのように保持するかを確認します。保存された通常時の境界より短いディスプレイ上で、最大化されたウィンドウが復元されれば完了です。利用可能であれば、ウィンドウ状態のテストで確認してください。

索引モデルが issue の本文から書いたものです。

説明

reproduced

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 --version on 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

  1. Use a display whose height in Electron DIP is below 800 (e.g. 1366×768; Electron reports 1388×781 here).
  2. Launch the desktop app with a fresh profile (default window size is 1280×800).
  3. Maximize the window.
  4. 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。