Repository navigation
Shrink the menu bar window when the panel loses a row, and release 1.1.2 - #4
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.fittingSizeand did nothing at all. Instrumenting a CI build and reading its log showed why:The
MenuBarExtraHostingViewreports 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
onGeometryChangehands 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
Metricssince then, so there is nothing flexible left to collapse.Test plan