diff options
| -rw-r--r-- | Sources/bar/Config.swift | 2 | ||||
| -rw-r--r-- | 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 } } |
