Skip to content

🐛 Fix menu bar height being capped at 24pt on Retina displays - #82

Open
xpaulso wants to merge 1 commit into
igorkulman:mainfrom
xpaulso:fix-menu-bar-height
Open

xpaulso wants to merge 1 commit into
igorkulman:mainfrom
xpaulso:fix-menu-bar-height

Conversation

@xpaulso

@xpaulso xpaulso commented Oct 30, 2026

Copy link
Copy Markdown

Problem

The generated menu bar rectangle is shorter than the actual menu bar. On my 2x display with a 30pt menu bar (60px), the tool draws a 48px bar, leaving a strip of the original wallpaper visible below it.

Cause

  • NSScreen.menuBarHeight multiplied the measured height by backingScaleFactor before checking it against the > 40 safety limit. On Retina displays even a standard 24pt menu bar is 48px, so the real measurement was always rejected and replaced with the 24pt default. Taller menu bars (e.g. on notched MacBooks, ~37pt) were affected the most.
  • combineImages then capped the drawn height to 24 * NSScreen.main.backingScaleFactor again, so even a correct measurement couldn't get through.

Fix

  • Measure and validate the menu bar height in points (frame.maxY - visibleFrame.maxY), also considering safeAreaInsets.top on macOS 12+ for notched displays.
  • For screens where no menu bar can be measured (secondary displays, auto-hidden menu bar), fall back to the primary screen's measured height, then to 24pt.
  • combineImages draws the added image at its own height, which is already sized for the target screen.

Testing

Built with swift build. On my setup (2x main display with a 30pt menu bar plus a secondary display without a menu bar) the calculated height is now 60px instead of 48px, and the secondary display uses the main screen's height.

🤖 Generated with Claude Code

The measured height was compared against a 40 limit after being scaled
by the backing scale factor, so on Retina displays any real menu bar
(e.g. 30pt = 60px) was rejected and replaced with 24pt. combineImages
then capped the height to 24pt again.

Measure and validate the height in points, take the notch safe area
into account, fall back to the primary screen's menu bar height for
displays without one, and draw the bar at the measured height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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