fix: clamp startup window size to the current screen - #8
Merged
Conversation
The window was created at a fixed 1024x768 logical pixels. On Windows those are scaled by the monitor DPI, so at 150% scaling the window was created at 1536x1152 physical pixels — taller than a 1080p work area — and Wails centers it, leaving it clipped at both the top and the bottom. 768 is also taller than the work area of a 1366x768 display at 100%. Clamp the startup size to a fraction of the current screen and re-center, and set a minimum window size. Fixes #5
Owner
Author
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Wails application’s startup window sizing logic so the initial window fits within the current screen (including common Windows DPI-scaling scenarios) and avoids being clipped off-screen on launch.
Changes:
- Replaces the hard-coded 1024×768 startup size with shared
defaultWidth/defaultHeightconstants and adds a minimum window size. - Adds startup-time logic (
fitWindowToScreen) to clamp the initial window size to a fraction of the current screen and re-center the window.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main.go | Uses shared default dimensions and sets MinWidth/MinHeight in Wails app options. |
| src/app.go | Introduces default sizing constants and adds startup logic to clamp window size to the current screen and re-center. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
The window was created at a fixed 1024x768 logical pixels. On Windows those are scaled by the monitor DPI, so at 150% scaling the window was created at 1536x1152 physical pixels — taller than a 1080p work area — and Wails centers it, leaving it clipped at both the top and the bottom. 768 is also taller than the work area of a 1366x768 display at 100%.
Clamp the startup size to a fraction of the current screen and re-center, and set a minimum window size.
Fixes #5