Fix: apply gaps to half-tiles when maximize-with-gap is enabled - #456
gabriel-kassai wants to merge 4 commits into
Conversation
Half-tiled windows lost their gaps on the maximized axis because verticalMaximize / horizontalMaximize apply set_maximize_flags(...), and Meta's maximize snaps the window to the full work-area extent, overriding the gapped rect from addGaps(). Quarter-tiles are unaffected (they use the override_constraints path, which preserves gaps); full maximize-with-gap is also unaffected (it already skips window.maximize() when gaps are on). When maximize-with-gap is enabled, skip the VERTICAL/HORIZONTAL maximize flag so half-tiles fall through to the same gap-preserving override_constraints path quarter-tiles use. When maximize-with-gap is off, behaviour is unchanged. Fixes ubuntu#448
There was a problem hiding this comment.
Pull request overview
This PR fixes a gaps regression for half-tiling (vertical/horizontal maximize) when the maximize-with-gap setting is enabled, by avoiding Meta’s maximize behavior that snaps windows to the full work-area and overrides the gapped rectangle.
Changes:
- Skip applying
VERTICAL/HORIZONTALmaximize flags whenmaximize-with-gapis enabled, so half-tiles keep gaps. - Let half-tiles use the same
override_constraints-based path as quarter-tiles (and consistent with existing full maximize-with-gap behavior).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // top/bottom (or left/right) gaps. Fall through to the override_constraints | ||
| // path used by quarter-tiles, which preserves gaps. Mirrors the | ||
| // full-maximize-with-gap handling above. |
There was a problem hiding this comment.
I would be more concerned with what happens if window.override_constraints does not exist (i.e. on non-Ubuntu)?
The gap-preserving fallback for a half-tile is the override_constraints() branch, which is not present on every Mutter build. Gate the new behaviour on it so that where it is missing the VERTICAL/HORIZONTAL maximize flag is still applied, keeping the previous behaviour instead of leaving the half-tile unmaximized. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ailable" This reverts commit e3e120a.
|
Sorry for the long silence here. I was away and then buried in school, and this fell off my radar. Thanks for the review and for the patience. Also sorry for the commit noise above. I reverted the fix by accident while cleaning up the branch, then put it back. The current head is the one to look at. You're right, and the first version was wrong on non-Ubuntu. Skipping the maximize flag only works because I've pushed a commit that gates the new path on That also covers the Copilot note about the comment wording. The comment now says the fallback is conditional and why. One caveat: I've only tested this on Ubuntu 26.04 with GNOME Shell 50, where the bug reproduces. The unpatched-Mutter case is reasoned rather than tested, but it should now be the old behavior exactly. |
Fixes #448.
Half-tiled windows lost their gaps on the maximized axis because
verticalMaximize/horizontalMaximizeapplyset_maximize_flags(...), and Meta's maximize snaps the window to the full work-area extent, overriding the gapped rect fromaddGaps(). Quarter-tiles are unaffected (they use theoverride_constraintspath, which preserves gaps); full maximize-with-gap is also unaffected (it already skipswindow.maximize()when gaps are on).This makes the vertical/horizontal cases consistent: when
maximize-with-gapis enabled they skip the maximize flag and fall through to theoverride_constraintsbranch, so half-tiles keep their configured gaps. Whenmaximize-with-gapis off, behaviour is unchanged.Trade-off (intentional, matches existing behaviour): a gapped half-tile is no longer reported to Meta as vertically/horizontally maximized — it's a normal constrained tile, exactly like a gapped quarter-tile and like the full maximize-with-gap window. Tile-group/restore behaviour is driven by the extension's own
tiledRect/untiledRecttracking, not Meta's maximize state.Testing: with gaps +
maximize-with-gapon, half-tiles now show gaps on all four edges; withmaximize-with-gapoff, half-tiles behave as before. Verified on GNOME Shell 50 / Wayland.