Repository navigation
Fit a floating window to the monitor it is moved to - #18143
Open
LOLCATATONIA wants to merge 20 commits into
Open
LOLCATATONIA wants to merge 20 commits into
LOLCATATONIA wants to merge 20 commits into
Conversation
Super + arrows put the window in that half, then a quarter (KWin's rules), and towards the edge it is against already they maximize it; anywhere but a floating workspace they move focus as before. Dragging a window to a side edge snaps it to that half, near a corner to a quarter, and to the top edge maximizes, with an outline of the target drawn by a new shell plugin; on an edge shared with another monitor it snaps only after a pause. A snapped window dragged away gets its size back, and a window too large for a tile is left as it is. The drags come from the titlebars plugin's hyprbars.drag_* events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A window the floating mode opens beside snapped ones goes into the one tile they leave free: the right half beside a left half, the fourth quarter beside three. With the screen filled exactly, the half used last makes room, keeping its top (or left) quarter. Closing a window on a quarter gives its space back to the window sharing its half. Only snapped windows are arranged, never while one is maximized, and nothing else moves windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Floating a tiled workspace sized every window the same and centred them in a cascade, a pile of cards. Each window now keeps the box tiling gave it: near a half or quarter (within 5%) it becomes that snapped tile, any other box on screen stays as it is, and one off the screen, such as a scrolling column, joins the snapped windows as a new window would, on the half on its side. Dragged away, a kept window takes the mode's comfortable size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hyprland keeps a floating window's size when it moves to another monitor, so a half from a laptop was smaller than a half on a larger monitor, and one from there hung off the laptop. Moved by Super + Shift + Ctrl + arrows, a window in a tile, or close to one, takes that tile on the new monitor, and any other keeps its place and size relative to the screen; Lua learns of the move only afterwards, so the move command reads the window's box first. Dragged onto another monitor and let go away from an edge, a window stays where it was put, shrunk to fit that screen when it is larger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LOLCATATONIA
marked this pull request as ready for review
November 8, 2026 10:27
Contributor
[Medium impact] The PR appears safe to merge; both numbered findings are addressed. SummaryThis PR fits floating windows to the monitor they move to and builds on the stacked snapping changes.
|
Beside a shorter monitor only part of an edge is shared, so a drag could enter a zone where the edge is outer, snapping at once, and slide on into the part the other monitor shares without leaving the zone: the early return kept the snap, and letting go there skipped the pause meant for crossing over. The drag now keeps whether the edge under the pointer is shared, and starts over when that changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A snap from maximized first waits for the window's own size, and an arrow pressed meanwhile read the window as it was, not the tile already asked for: Left then Up gave the top half. A pending placement now carries its tile, and the next arrow starts from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # test/shell.d/hyprland-floating-workspaces-test.sh
On the first switch to floating in a session the titlebars plugin is only asked for, and Hyprland loads it on the next config pass: windows kept in place then took their whole tile, and the titlebar added afterwards stuck out above it, so they no longer counted as snapped. The height now comes from Omarchy's own titlebar setting rather than from the plugin. An app that draws its own frame (Chromium, Omarchy's browser) gets no titlebar at all, so it is tagged where that rule is made, and keeps its whole tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g drops Moved to another monitor, a window whose own limits refused the scaled size got its old size back at the position worked out for the smaller box, partly off a smaller screen. Its size is now held within its limits and the box fitted onto the screen at that size. Dropped onto another monitor, a dialog landing on a tiled workspace was fitted too; that is only for floating workspaces. Both handlers, by key and by drag, now have tests of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the first switch to floating in a session, windows are kept in place before the titlebars plugin is in and before the rule marking apps that draw their own frame applies, so a browser was left room for a titlebar it never gets. Once the plugin is in, a window snapping placed whose box would be its tile with the titlebar the other way round goes back into that tile; a window already in its tile, or resized by hand, stays as it is. Checked with Chromium in a nested Hyprland through the layout toggle's own reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether the edge under the pointer is shared is now asked on every motion in a zone; the monitor layout behind it stays put during a drag, so it is read once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…our's A closing window has lost its titlebar, so its tile was measured with a snapped neighbour's decorations, which miss when one of them is a browser drawing its own frame. It is now measured with the neighbour's decorations, then with a titlebar more or less; the two differ by far less than any two tiles, so at most one fits. Tested both ways round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # test/shell.d/hyprland-floating-workspaces-test.sh
A snap from maximized waits for the window's own size first. A window moved to another monitor meanwhile was pulled back to the tile on the old one; the snap now gives up when the window is on another monitor by the time it runs, however it got there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 22, 2026
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.
What changes
Stacked on #18142 (Super + L keeping places), itself on #18141 (snapping), so their commits show here too.
Hyprland keeps a floating window's size when it moves to another monitor. A half moved from a laptop to a 1440p monitor is a narrow strip there, and a half moved back hangs off the laptop's screen.
Super + Shift + Ctrl + Arrow, a window in a tile, or close to one (within 5%, as after resizing it to a half by hand), takes that tile on the new monitor; any other window keeps its place and size relative to the screen, so moving it back gives it its own box again.Lua learns of a move only after Hyprland made it, and not which monitor it came from, so
o.workspaces.move_window_to_monitorreads the window's box before it moves and hands it to snapping (o.snap.carried). Only floating workspaces: a window moved to a tiled one tiles there as before. It usesnear_tilefrom #18142, hence the stacking.Verification
./test/all: see Snap windows on floating workspaces #18141 (run on the whole stack).Screenshots
Not recorded: it needs two monitors. The snapping PR (#18141) has a recording of what it builds on, and the two-monitor checks above run on a laptop at 1.5 beside a 2560x1440 monitor. Happy to add screenshots if it helps.
🤖 Generated with Claude Code