Repository navigation
Conversation
A window maximized while the work area was the whole monitor keeps that size as its restore rectangle, so restoring it later leaves it past the screen edge and under the bar (Lemxy#268). Clamp a maximized window's normal placement into its monitor's work area, and shrink a restored window still carrying the maximized frame. Hiding a maximized window from the bar and bringing it back now restores it maximized in one step, without the restore-then-maximize flicker.
Lemxy
added a commit
that referenced
this pull request
Dec 1, 2026
Restore rectangles are clamped into the work area; a maximized window hidden from the bar comes back maximized. Co-authored-by: 2sulraw <306633824+2sulraw@users.noreply.github.com>
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.
Problem
When the bar reserves a strip of the screen (the work area is smaller than the monitor), windows can end up with a restore rectangle (
rcNormalPosition) taken from a maximized window — the full monitor plus the frame border. Restoring such a window then places it past the screen edge and under the bar (#268). Hiding a maximized window with its bar button and bringing it back could likewise return it un-maximized (and oversized).Reproduced with Chromium windows (Chrome, Helium) and Discord on a 1920x1080 monitor with a bottom bar: a maximized window's normal rect was 1936x1096 against a 1920x1040 work area.
Changes
plugins/topbar/src/main.rs:fit_normal: clamp a maximized window's restore rectangle into its monitor's work area, so a later restore lands inside it. Runs on work-area changes and on the regular window refresh.fit_restored: a restored window still carrying the maximized frame (larger than the monitor on both axes, but only by the invisible border) is shrunk back to the work area. Only that exact shape is touched, so a window spanning two monitors or one genuinely larger is left alone.bring: a window that was maximized before it was hidden now comes back maximized in a single step (SetWindowPlacementwithSW_SHOWMAXIMIZED) instead of restore-then-maximize, which visibly flickered. The pre-minimize maximized state is recorded where the bar minimizes the window, so it also works when the placement flag (WPF_RESTORETOMAXIMIZED) is missing.Borderless fullscreen games and windows spanning monitors are not maximized, so they are left untouched; other minimized windows keep the existing
SwitchToThisWindowpath.Refs #268
Testing
Windows 11, two monitors, bottom bar reserving 40 px:
rcNormalPositionclamped to the work area (1920x1040);