Skip to content

Snap windows on floating workspaces - #18141

Open
LOLCATATONIA wants to merge 7 commits into
omacom:quattrofrom
LOLCATATONIA:floating-window-snapping
Open

LOLCATATONIA wants to merge 7 commits into
omacom:quattrofrom
LOLCATATONIA:floating-window-snapping

Conversation

@LOLCATATONIA

@LOLCATATONIA LOLCATATONIA commented Nov 8, 2026 •

Copy link
Copy Markdown

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 + Arrow puts the window in that half, and a second arrow makes it a quarter (Left, then Up = top-left), following KWin's quick-tiling rules.
  • Pressing toward the edge the window is already against maximizes it, and an arrow on a maximized window gives that half. KWin moves the window to the next monitor there instead; Omarchy already has Super + Shift + Ctrl + Arrow for that.
  • Arrows pressed in quick succession build on each other, also from a maximized window, which first waits for its own size back.
  • On a tiled workspace, Super + Arrow moves focus exactly as before.

Dragging, by the titlebar, Super + drag, or an app's own titlebar (events from omacom/omarchy-hyprland-titlebars#15):

  • A side edge snaps to that half, its top or bottom quarter to a quarter, and the top edge maximizes.
  • An outline in the theme's accent shows the target while dragging: a new first-party shell plugin, 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.
  • On an edge shared with another monitor it snaps only after a pause, so windows can still be dragged across. Monitors of different sizes share only part of an edge, so it is the spot across from the pointer that counts.
  • A tile on another monitor moves the window to that monitor's workspace; otherwise Hyprland would give a dropped window the workspace under its centre, which can be the monitor it came from.
  • A snapped window dragged away gets back the size it had before. It's kept in a snap-restore tag, so it follows the window across workspaces and reloads.
  • A window too large for the tile (its minimum size) is left as it is, checked before anything moves.

Arrangement, among snapped windows only (its own commit)

  • A new window opens into the one tile its snapped neighbours leave free. With none free and the screen filled exactly, it shares the half used last: that window keeps the top quarter, the new one takes the bottom. Only windows the floating mode opens, not dialogs or apps with their own float rules.
  • Closing a window on a quarter gives its space back to the window sharing its half, also when one of them is a browser drawing its own frame and the other has a titlebar.
  • Nothing else moves windows. A workspace with nothing snapped behaves as before, and nothing rearranges while a window is maximized.

Files

  • default/hypr/window-snapping-geometry.lua: pure geometry, with no Hyprland calls.
  • default/hypr/window-snapping.lua: the behaviour.
  • workspace-modes.lua exposes floating().
  • The arrow binds call o.snap.action(...), which the keybindings menu can replay.
  • The manual's navigation and hotkeys pages, and default/i18n/en/keybindings.json (English only).

On moving Super + Arrow. AGENTS.md asks not to move existing hotkeys. Super + Arrow keeps focus everywhere it has meaning today; on floating workspaces focus follows the click, and Super + Arrow is the snapping key on Windows, KDE and GNOME. Happy to move it to another key if you'd prefer.

Verification

  • ./test/all on today's quattro with 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 plain quattro on this machine (lock-appear-budget-test.sh, a start-time budget, and tray-symbolic-icon-test.sh), so they are not from this change.
  • On this PR alone: the floating-workspaces, workspace-layout, monitor-workspaces, default-config, binding-conflicts, keybindings-menu and i18n tests pass.
  • hyprland-floating-workspaces-test.sh goes 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.
  • In a nested Hyprland 0.57.1 running a real Omarchy config with this PR, the titlebars PR, and scripted keyboard and pointer input (the host desktop never receives it):
    • every key transition, including maximize and back, focus unchanged on a tiled workspace, drag to each zone with the outline, restore on pickup, and a window resized after snapping (32);
    • windows with a minimum size, including one too large for a half (9);
    • other mouse buttons during a drag (5);
    • quick repeated presses (4);
    • X11 apps, with their own size hints (7);
    • grouped windows, groupbar included (5);
    • opening five windows and closing them back down (11);
    • two monitors laid out as a laptop at scale 1.5 beside a 2560x1440 monitor at 1.0, sharing part of an edge (18): a quick drag across and a pause at the shared part, the outer part snapping at once, the outline on the right monitor, maximize staying on its monitor, and arrangement per monitor.
  • In use on my laptop on the edge channel with this stack, the dock PR and the titlebars PR, alone and with an external monitor.
  • The whole stack merges cleanly with Keep a maximized window maximized when another app opens on floating workspaces #17491 and the two PRs it is stacked on, and the floating-workspaces, layout, monitor-workspaces, dock and default-config tests pass on the merge.
  • Not checked: the acceptance suite in a VM; rotated or stacked (one above the other) monitors beyond the geometry tests.

Screenshots

snapping-take1-1280

🤖 Generated with Claude Code

QuixoticGitHub and others added 2 commits November 8, 2026 10:39
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>
@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Adds window snapping on floating workspaces, with keyboard shortcuts, drag previews, and arrangement of snapped windows.

  • Floating workspaces snap windows from the keyboard.
  • Snapped neighbors make room for new windows and reclaim space when one closes.
  • Dragging a floating window to an edge shows where it will snap.

Reviews (4) · Last reviewed commit: "Give a closed quarter back when its titl..." · Reviewed by Greptile

Comment thread default/hypr/window-snapping.lua Resolved
Comment thread default/hypr/window-snapping.lua Resolved
@viperd21-debug

Copy link
Copy Markdown

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!

QuixoticGitHub and others added 4 commits November 17, 2026 17:24
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>
Comment thread default/hypr/window-snapping.lua Resolved
…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>
@greptile-apps

greptile-apps Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@omarchybot omarchybot added the enhancement New feature or request label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants