Skip to content

Resize adjacent snapped windows with a draggable divider - #1907

Open
kiteretsu903 wants to merge 33 commits into
rxhanson:mainfrom
kiteretsu903:fix/review-window-dividers
Open

kiteretsu903 wants to merge 33 commits into
rxhanson:mainfrom
kiteretsu903:fix/review-window-dividers

Conversation

@kiteretsu903

@kiteretsu903 kiteretsu903 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds opt-in Drag dividers to resize adjacent windows under Adjacent Windows, off by default. Hovering between an adjacent snapped pair shows a handle at the actual boundary—including unequal splits from Fit—and works with Fit disabled. Dragging previews the split and commits both window sizes on release, double-clicking requests an equal split within minimum sizes, and pressing Escape cancels an active drag or rolls back an in-flight resize. This PR builds on #1904's BlurSurfaceView renderer and #1903's achieved-frame completion notification and command identity.

Behavior

Scenario Behavior
Hover between adjacent snapped windows Shows the handle at the actual boundary, including unequal Fit splits or pairs created with Fit off
Drag and release the handle Moves the split preview during drag and commits both window sizes on release within minimum sizes
Double-click the handle Requests an equal split while respecting minimum window sizes
Press Escape during drag or placement Cancels the drag or rolls back an in-flight resize
Snap or Restore during a divider write Waits for the active asynchronous placement operation to settle before reading geometry or writing, while unrelated window commands that do not touch a shared cooperative neighbor proceed
Bulk layout or Todo during a divider write Waits for the active asynchronous placement operation to settle, drains queued shared layouts in order before later window commands run, and leaves non-writing stack cycling immediate
Overlay material in App Settings Offers No blur, Standard blur, and Liquid Glass (on macOS 26+) with an info tooltip covering snap previews, divider handles, stack lists, and window size warnings; migrates footprintBlur from main and preserves blurMaterial from #1904

Why WindowManager, ShortcutManager, and hooks change

Divider requires deeper coordination than Fit because it resizes two windows asynchronously over Accessibility, issued AX calls cannot be recalled, and Restore bypasses move delegates. Pairing, drag tracking, capture, and preview remain inside the Divider module, while the coordination layer integrates with WindowManager and ShortcutManager to order execution, publish history, and transfer write ownership. Divider and cooperative resize use these contracts today; another internal feature can participate in the same coordination path while keeping its own policy and interaction logic in its module:

Extension point Current use Reuse value
WindowActionDispatcher (injected into ShortcutManager) Prepares commands before display-cycle geometry lookup or direct bulk writes. When an external divider write is active, it captures the intended target window before focus can change and waits until the full asynchronous placement settles and the pair's achieved frames and history are published. To avoid querying a busy member on the main thread during target capture, it reuses an existing reservation only when a fresh WindowServer list shows the frontmost app's foremost visible window is at normal level and matches that reservation; if a floating window or another window is foremost, it falls back to standard Accessibility focus resolution. Other external writers participating in the shared fence can use the same wait-before-dispatch and target-capture path without adding feature-specific gates to ShortcutManager.
WindowPlacementCoordinator and WindowWriteFence Manage execution ownership, waiting, no-op and targetless Restore takeover, and cross-display retries across the external Divider writer, ordinary Snap/Restore, frame-writing bulk actions (Tile, Cascade, Reverse), and Todo mode, while non-writing stack cycling runs immediately. Resumed commands on a divider member keep their window scope so an unrelated animation on window C completes without being cancelled, and shared layouts drain in order ahead of later member commands. Another asynchronous multi-window internal feature can explicitly reserve its affected windows through the same fence and coordinate with ordinary commands rather than adding feature-specific cancellation or ordering branches to WindowManager. Its policy and interaction logic remain in that feature.
WindowManagerDelegate.additionalWriteTargets(in candidates:) (default []) CooperativeMove filters current external reservations (candidates) to those it may also touch during cooperative placement or source cleanup, so a command on focused window C still waits when it would also write neighbor B. Other internal delegates can report overlap with active reservations, allowing the manager to wait for those windows through the same mechanism.
WindowManagerDelegate.moveDidAccept() (default no-op) CooperativeMove commits planned side-split state only after admission and waiting finish. Other internal delegates can keep planning state provisional until the move is accepted.

While an external writer is active, SnappingManager also moves fullscreen AX checks off the main thread with generation and frontmost-app guards so app activation stays responsive for other apps.

I would appreciate your feedback on whether this coordination boundary and hook placement fit the extension model you want for WindowManager and ShortcutManager.

Enhanced transitions

To hide sequential two-window resizing and intermediate flicker on release, an optional Enhanced transitions toggle under Adjacent Windows (macOS 14+, gated by explicit Screen Recording permission) uses ScreenCaptureKit to capture one temporary screenshot at drag start, excluding Rectangle's own overlays and covering the pair plus a shadow margin. Separate moving guides render above that frozen image, holding the pair visually steady until both window writes are acknowledged and then fading out.

Capture is asynchronous and optional: if permission is denied, unavailable, or the screenshot arrives after release, the normal live guide continues to work. The captured image remains transient in memory, with no saved image or audio recording.

Verification

  • Unit tests: 920 tests, 2 skipped, zero failures.
  • Native E2E: Passed horizontal and vertical dividers, all three overlay materials (No blur, Standard blur, Liquid Glass), unequal Fit+Divider splits, hidden minimum sizes, Escape cancellation/rollback, member Restore captured during a divider write with concurrent unrelated animation completing without cancellation, independent window movement while a member is held, Enhanced transitions with capture, Tile during a write, two queued Todo requests during a write, cooperative divider, and Fit with cooperative resize.

Review order

Review the Divider changes on top of #1903. Merge in order: #1904 → #1903 → #1907. If the prerequisite PRs are squash-merged, replay this layer on the resulting main before merging it.

Demo

10-window-dividers.mp4

@kiteretsu903
kiteretsu903 force-pushed the fix/review-window-dividers branch 3 times, most recently from 706710b to 0ba8225 Compare October 14, 2026 01:46
@kiteretsu903
kiteretsu903 force-pushed the fix/review-window-dividers branch from 9f7dd7c to efe8e7d Compare November 22, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant