Notes

Fitting windows above a floating Dock.

Panes snaps windows to halves and corners from the keyboard. A bottom half should stop right where the Dock starts. On macOS 26 that turned out to be the hardest part of the app.

All the rectangles below are in Accessibility coordinates: the origin is the top-left of the main display, and y goes down.

Why the visible frame isn't enough

The usual answer is NSScreen.visibleFrame, the part of the screen macOS says is free of the menu bar and the Dock. On macOS 14 and 15 that works, because the classic Dock sits outside it.

On macOS 26 the Dock floats. It sits a few points off the screen edge on a glass plate, and the plate pokes up into the visible frame. On a MacBook at 1800 × 1169 pt, the visible frame ends at y = 1096 and the top of the plate is at 1066. A window snapped to the visible frame ends 30 pt behind the Dock.

So Panes has to find the plate itself. In the code that rectangle is called B, for backdrop.

Four ways to find it, best first

Panes tries four sources in order and remembers which one won: Accessibility, measured, estimate and visible frame. Before any of them it reads the Dock's settings from com.apple.dock (auto-hide, orientation, tilesize, magnification and largesize), syncing the preferences first so a change shows up straight away.

0. Ask the Dock through Accessibility

Panes already has the Accessibility permission, so first it asks the Dock process for its children and keeps the ones with the role AXList, which is the icon strip. It reads only role, position and size, with a 0.3 second timeout so a hung Dock can't stall a snap.

This goes first because it doesn't depend on tilesize, which macOS quietly overrides when it shrinks a crowded Dock, or on the shape of the Dock's windows. On macOS 26 the Dock has one full-screen window and no separate plate window to look for.

A list only counts if it looks like a Dock strip:

The icon strip is a little smaller than the glass plate, so for a floating Dock Panes grows it by 4 pt on the side facing the middle of the screen. The classic Dock gets no padding: its visible frame already leaves room for all of it, and padding could only eat into that.

On a crowded Dock the strip runs from y = 1080 to 1157. Padded, B starts at 1076, and a bottom-half window ends at exactly 1076.

1. Measure the Dock's windows

If Accessibility gives nothing usable, Panes takes one snapshot of the on-screen windows and keeps the ones at the Dock's window level that belong to the Dock and aren't fully transparent. It reads their bounds, owner, level and alpha. It never reads window titles.

It then picks B for each display. It skips any window covering 90% or more of the display, and anything away from the edge, like a stack popover. Then it tries three shapes in order:

  1. 1. A plate whose thickness matches tilesize plus padding on both sides, within 4 pt.
  2. 2. A floating plate that sits the floating margin away from the edge (give or take 4 pt) and is plate-sized: at most 2.5 × tilesize and 200 pt. This one is used as it is even if the thickness doesn't match, which covers a wrong tilesize. With a 97 pt plate and a tilesize of 64 or 48, B is still the plate.
  3. 3. A larger window touching the edge, which is what macOS 14 and 15 look like. B becomes a band of the expected thickness along its edge side, without adding the floating margin twice.

This step only runs on macOS versions whose numbers have actually been measured.

2. Estimate it

If both measurements fail, Panes guesses. The numbers live in one table keyed by macOS major version: no floating margin and 4 pt of padding on macOS 14 and 15, a 6 pt margin and 6 pt of padding on macOS 26. A future macOS version Panes doesn't know yet gets the newest row, in estimate mode only, so step 1 is skipped. A missing tilesize means it was never changed, so the macOS default of 48 is used.

The estimate is a full-length band, one margin away from the edge and one plate thick. The trouble is that tilesize can lie. A Dock set to 128 gets its icons shrunk to about 56 pt by macOS when it's crowded. Taken at face value the band is 140 pt thick with its top at 1023. An early version also kept an 8 pt margin on top of that, so windows stopped at 1015, about 60 pt above the real plate.

The fix is to cap the estimate by what macOS itself reserves for the Dock, the visible frame's inset from the display edge. The band can't be more than 24 pt thicker than that. That Dock reserves 72 pt, so the band becomes 90 pt and its top lands at 1073, about 3 pt above the real plate at 1076. Left and right Docks are capped the same way.

A classic Dock gets no estimate at all. It's already outside the visible frame, so a guessed band could only get in the way.

3. Fall back to the visible frame

With auto-hide on, while the Dock is restarting, or with no displays, Panes uses the visible frame as it is.

From B to the usable area

The usable area is the visible frame cut at B's inner side. It only ever shrinks the visible frame, never grows it, and it's flush with the plate. The gap between windows is applied later, inside that area, so with a 10 pt gap a bottom-half window ends at 1056 instead of 1066.

If B would leave less than half of the visible frame, Panes decides the measurement is wrong and ignores it.

The edge cases

When it measures

There's no polling. The cached result goes stale after one second and is only refreshed when something needs the displays, like a snap or the start of a drag, never while a drag is moving.

The cache is thrown away on display changes, on wake, when the Dock relaunches and when the Dock's preferences change. The Dock may still be animating at that point, so a measurement taken in the next second only counts until the animation ends.

What still goes wrong

The estimate is a guess. On the test numbers, a window snapped to it still ends 6 pt behind the plate. It's only used when both measurements fail, but it's there. The table's numbers are starting values, which is why macOS versions Panes doesn't know drop to estimate mode.

If a window lands under your Dock, open Panes Settings, go to Help and click Copy Diagnostics. It copies one line with the source that won, the Dock's edge, auto-hide and B, and no window titles. Send that line to [email protected] and we'll look at it.

Download Panes