Repository navigation
Snap windows on floating workspaces - #18141
LOLCATATONIA wants to merge 7 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>
[Medium impact] The PR appears safe to merge; no new actionable issues remain. SummaryAdds window snapping on floating workspaces, with keyboard shortcuts, drag previews, and arrangement of snapped windows.
Reviews (4) · Last reviewed commit: "Give a closed quarter back when its titl..." · Reviewed by Greptile |
|
Tested on Omarchy dev channel (quattro + this PR), Hyprland 0.57.2, with omarchy-hyprland-titlebars#15 built from source for drag snapping. Snapping works well on a floating workspace: dragging a window to the left or right edge snaps it to that half, and dragging to the top makes it full screen. The Super+Arrow keybindings also snap as described. Dragging a snapped window away brings it back to its original size. No issues so far. Thanks for this! |
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>
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>
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
What changes
Floating workspaces have no way to put windows side by side except dragging and resizing each one by hand. Snapping was cut from floating mode for scope before it shipped (
97fd964c), and #17754 asked whether it should come back as a plugin or in core. This adds it in core, the way Windows and KDE do it: my take on sane defaults, every one of them open to change. Overview: #18145. Two small PRs build on this one: #18142 (Super + L keeps the tiling's places) and #18143 (windows fit the monitor they move to).Only on floating workspaces. Tiled workspaces are unchanged.
Keyboard
Super + Arrowputs the window in that half, and a second arrow makes it a quarter (Left, thenUp= top-left), following KWin's quick-tiling rules.Super + Shift + Ctrl + Arrowfor that.Super + Arrowmoves focus exactly as before.Dragging, by the titlebar,
Super+ drag, or an app's own titlebar (events from omacom/omarchy-hyprland-titlebars#15):omarchy.snap-preview. Lua announces the box as a Hyprland custom event, and the plugin parses only an exact, bounded message, since any client on the socket can send one.snap-restoretag, so it follows the window across workspaces and reloads.Arrangement, among snapped windows only (its own commit)
Files
default/hypr/window-snapping-geometry.lua: pure geometry, with no Hyprland calls.default/hypr/window-snapping.lua: the behaviour.workspace-modes.luaexposesfloating().o.snap.action(...), which the keybindings menu can replay.default/i18n/en/keybindings.json(English only).On moving Super + Arrow. AGENTS.md asks not to move existing hotkeys.
Super + Arrowkeeps focus everywhere it has meaning today; on floating workspaces focus follows the click, andSuper + Arrowis the snapping key on Windows, KDE and GNOME. Happy to move it to another key if you'd prefer.Verification
./test/allon today'squattrowith this PR, the two stacked on it, the dock PR and Bring a maximized window to the front when the user focuses it on floating workspaces #17361: 7859 pass; two fail the same way on plainquattroon this machine (lock-appear-budget-test.sh, a start-time budget, andtray-symbolic-icon-test.sh), so they are not from this change.hyprland-floating-workspaces-test.shgoes from 44 to 62 checks: KWin's key rules and maximize, tile geometry and drag zones, shared and partly shared monitor edges, size limits, drag snapping, open and close arrangement, and the outline's message parser (Node). Each new check was confirmed to fail with its feature removed. Two of them queue timers instead of running them at once, as the stub otherwise does: a drag sliding along an edge into the part another monitor shares, and quick arrows on a maximized window.Screenshots
🤖 Generated with Claude Code