From 4428d08a1498e737be87041906ebc4a1840a9b79 Mon Sep 17 00:00:00 2001 From: Tommaso Negri Date: Fri, 28 Aug 2026 16:34:07 +0200 Subject: fix a placement issue on notched displays --- Sources/bar/Config.swift | 2 -- Sources/bar/Views/BarWindow.swift | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/bar/Config.swift b/Sources/bar/Config.swift index 83ca8b0..f1edf01 100644 --- a/Sources/bar/Config.swift +++ b/Sources/bar/Config.swift @@ -6,8 +6,6 @@ import SwiftUI /// This is the primary file a user edits to customise *bar*. enum Config { /// The bar height in points (pt). - /// - /// > Tip: Set this value to 30 to match the default Mac menu bar height. static let height: Double = 30 /// The bar position on the screen. diff --git a/Sources/bar/Views/BarWindow.swift b/Sources/bar/Views/BarWindow.swift index c5b4117..843c564 100644 --- a/Sources/bar/Views/BarWindow.swift +++ b/Sources/bar/Views/BarWindow.swift @@ -27,6 +27,14 @@ final class BarWindow: NSPanel { level = .floating } + /// By default AppKit clamps the window frame so it never overlaps the + /// menu bar (or the notch on MacBook displays), pushing the bar below + /// the notch. `bar` must sit flush with the top edge of the screen + /// instead, so we opt out of the constraint and keep the frame as-is. + override func constrainFrameRect(_ frameRect: NSRect, to screen: NSScreen?) -> NSRect { + frameRect + } + override var canBecomeMain: Bool { false } override var canBecomeKey: Bool { true } } -- cgit v1.2.3