fix(shell): size the initial main window within the work area - #1274
Closed
130rockirt wants to merge 1 commit into
Closed
fix(shell): size the initial main window within the work area#1274130rockirt wants to merge 1 commit into
130rockirt wants to merge 1 commit into
Conversation
The main window always opened at a fixed 1280x840. On small or high-DPI-scaled displays whose work area is smaller than that (for example a 1280x800 panel at 150% scaling with a 1280x752 work area), Windows clamps the new window to fill the work area, so restoring from maximize returns to bounds that match the maximized size and the restore button looks like a no-op. Derive the initial bounds from the primary display work area: keep the 1280x840 default on large screens, cap at 85% of the work area (never below the 960x640 minimum), and center the window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the title-bar restore button appearing to do nothing on small or high-DPI-scaled displays.
1280x840. On displays whose work area is smaller than that (e.g. a 1280x800 panel at 150% scaling, work area 1280x752), Windows clamps the new window to fill the work area. The window therefore opens effectively full-screen, and restoring from maximize returns to bounds that match the maximized size — the window visibly never shrinks.1280x840default; smaller work areas get at most 85% of the work area (never below the960x640minimum), centered, so restore-from-maximize always shrinks visibly.Changes
src/main/main-window-initial-bounds.ts(new): pureresolveMainWindowInitialBounds(workArea)helper plus the exported min/default size constants.src/main/main-window.ts:createWindownow positions and sizes the window from the primary display work area instead of hardcodingwidth: 1280, height: 840.src/main/main-window-initial-bounds.test.ts(new): unit tests for large, small/scaled, tiny, and offset work areas.Tests
npx vitest run src/main/main-window-initial-bounds.test.ts src/main/main-window.auxiliary.test.ts— 6 passednpx vitest runon adjacent main-window suites (activation, renderer-recovery, storage-relocation, runtime-data-recovery) — 12 passednpm run typecheck— passedcreateWindowthen maximize → restore: