Skip to content

feat(settings): grow text and controls with the window (界面大小) - #104

Merged
xycld merged 1 commit into
mainfrom
fix/ui-scale-with-window
Nov 18, 2026
Merged

xycld merged 1 commit into
mainfrom
fix/ui-scale-with-window

Conversation

@xycld

@xycld xycld commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

What and why

Issue #10: enlarging the window did not make text or the UI any larger, so a maximized window on a large screen showed small text.

设置 › 通用 gets 界面大小: 自动 (default), 100%, 110%, 125% or 150%. It is applied as the window's zoom factor (shared/uiScale.ts, uiZoomFactor):

  • 自动 grows with the window: min(width / 1600, height / 1000), from 100% at the default window up to 150%, in 5% steps so resizing does not relayout at every pixel.
  • A fixed size stays put. Neither setting lets the page fall below its 1024 × 640 layout (the window's minimum), and neither goes under 100%.
  • Main process (main/windows.ts) applies it on every resize, after page load, and when the setting changes. It also moves the native title bar parts to the zoomed 40 px bar: the Windows overlay height and the macOS traffic lights.

How it was verified

  • pnpm lint (0 errors; the warnings were already there), pnpm format:check, pnpm typecheck, pnpm test:unit: 3836 passed, including the new test/shared/uiScale.test.ts (default window at 100%, growth and the 150% cap, the shorter side deciding, never below 100% or the minimum layout, 5% steps).
  • pnpm build && pnpm test:e2e: 449 passed. New in settings.e2e.ts: 界面大小 starts on 自动, and picking 125% saves { uiScale: '125' }.
  • Real app, not only the mock: the built app launched headless under xvfb with Playwright. At 1600 × 1000 the zoom factor was 1. At 2400 × 1500 it was 1.5, with innerWidth 1600, so the layout is the default one, drawn 50% larger. Back at 1600 × 1000 it was 1 again.
  • pnpm test:install: not applicable.
  • Docs: docs/reference/architecture.md (window section) and docs/how-to/setup.md (设置 › 通用).

Platforms affected

  • Windows: title bar overlay height follows the zoom.
  • Linux
  • macOS: the traffic lights move with the zoomed bar.

Notes for the reviewer

Only the zoom computation and the setting were tested automatically, on Linux. The overlay and traffic-light positions on Windows and macOS follow from the same factor, but they were not seen on those systems.

A maximized window on a large screen kept the default text and control
size. 设置 › 通用 now has 界面大小: 自动 (the default) zooms the window
with its size, from 100 % at the default 1600×1000 window up to 150 %;
fixed sizes from 100 % to 150 % are offered too. Neither lets the page
fall below its 1024×640 layout. Main applies the zoom factor on every
resize and moves the native title bar parts into the zoomed bar.
@xycld
xycld added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 999ee01 Nov 18, 2026
5 checks passed
@xycld
xycld deleted the fix/ui-scale-with-window branch November 18, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant