Skip to content

Shrink the menu bar window when the panel loses a row, and release 1.1.2 - #4

Merged
MylesShannon merged 4 commits into
mainfrom
panel-fitter
Aug 21, 2026
Merged

MylesShannon merged 4 commits into
mainfrom
panel-fitter

Conversation

@MylesShannon

@MylesShannon MylesShannon commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

Switching monitoring off takes the meters away and leaves a shadowed band of empty window above the panel. This is the fault 1.1.0 was meant to have fixed, reported against the 1.1.1 build installed through Sparkle.

Why it came back

It never went away in a release build. The 1.1.0 fix rebuilds the panel under a new identity and relies on SwiftUI sizing the window from scratch, which happens against the macOS 26 SDK my local builds use and not against the macOS 15 SDK the workflows pin. Every check of that fix was a local make install, so the one configuration that mattered was never looked at.

What was actually wrong

The first attempt on this branch set the window height from contentView.fittingSize and did nothing at all. Instrumenting a CI build and reading its log showed why:

level=101 frame=(2419,899 340x338) content=(0,0 340x338) fitting=0x0

The MenuBarExtraHostingView reports a fitting size of zero, so the code asked AppKit how tall the panel wanted to be, got nothing, and refused to resize to that — correctly, and silently.

The fix

SwiftUI knows the height, so onGeometryChange hands it to the window: 338 points with the meters, 239 without. Only shrinking happens here, since the log confirms the window grows on its own, and the top edge is held because the panel hangs from the menu bar. A measurement below a plausible panel height is ignored, so a bad number leaves the band rather than clipping the panel.

Setting the frame directly was rejected when this bug was first fixed, because a re-sized panel is afterwards laid out at its ideal size and the menus collapsed to the width of their own text. The controls have taken fixed widths from Metrics since then, so there is nothing flexible left to collapse.

Test plan

  • Verified on a CI build, which is the only place the fault appears: the panel shrinks back with no band, and a reading 400ms later confirms nothing puts the height back
  • Device, latency and channel menus keep their width after the resize
  • Optional: install the artifact from this branch, which is the same code with the logging removed

Switching monitoring off takes the meters away and left a shadowed band of empty
window above the panel, which is the fault 1.1.0 was meant to have fixed. It was
fixed against the macOS 26 SDK, where rebuilding the panel under a new identity is
enough for SwiftUI to size the window again, and releases are built against the 15
SDK, where it is not. Local builds could never have shown it.

The height is set on the window now rather than left to SwiftUI, keeping the top
edge where it is because the panel hangs from the menu bar. Setting the frame was
rejected the first time round because a re-sized panel is afterwards laid out at its
ideal size and every menu shrank to its own text; the controls take fixed widths
since then, so there is nothing left to collapse.
The fitter did not work. Local builds cannot show the fault and a menu bar panel
does not appear in CGWindowListCopyWindowInfo, so nothing about it can be measured
from outside the app.

This build writes the window's level, frame, content frame and fitting size to
~/Library/Logs/Sidetone-panel.log when the panel opens, when the layout changes, and
after any re-size, along with a reading 400ms later to catch a size being put back.
The height now comes from SwiftUI's own layout rather than AppKit's fitting size, and
the window is found by level rather than through a view that may not be in the
hierarchy yet, which is one candidate for why nothing happened.
Switching monitoring off takes the meters away and left a shadowed band of empty
window above the panel, which is the fault 1.1.0 was meant to have fixed. It was
fixed against the macOS 26 SDK, where rebuilding the panel under a new identity is
enough for SwiftUI to size the window again, and releases are built against the 15
SDK, where it is not. No local build could have shown it.

The first attempt asked AppKit how tall the panel wanted to be and quietly did
nothing, because the hosting view in a menu bar window answers fittingSize with
zero. SwiftUI knows the height, so it hands it over: 338 points with the meters and
239 without. Only shrinking is done here, since the window grows by itself, and the
top edge stays put because the panel hangs from the menu bar.
@MylesShannon MylesShannon changed the title Shrink the menu bar window when the panel loses a row Shrink the menu bar window when the panel loses a row, and release 1.1.2 Aug 21, 2026
@MylesShannon
MylesShannon merged commit c1ab01e into main Aug 21, 2026
2 checks passed
@MylesShannon
MylesShannon deleted the panel-fitter branch August 21, 2026 18:08
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