Skip to content

Commit 96a9a66

Browse files
committed
🐛 Approximate fix for wrong menu bar height on non primary displays
1 parent 7696576 commit 96a9a66

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Sources/ChangeMenuBarColor/Extensions/NSScreen+Extensions.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ extension NSScreen {
1414
}
1515

1616
var menuBarHeight: CGFloat {
17-
return (frame.size.height - visibleFrame.height - visibleFrame.origin.y) * backingScaleFactor
17+
let computedHeight = (frame.size.height - visibleFrame.height - visibleFrame.origin.y) * backingScaleFactor
18+
guard computedHeight > 0 else {
19+
Log.debug("Menu bar height computation is still not good, using approximation")
20+
return 25 * backingScaleFactor
21+
}
22+
23+
return computedHeight
1824
}
1925
}

0 commit comments

Comments
 (0)