@@ -46,6 +46,11 @@ final class BarWindowController: NSWindowController, NSWindowDelegate {
4646 private static let showDuration : TimeInterval = 0.22
4747 private static let hideDuration : TimeInterval = 0.16
4848
49+ private static var contentBottomExtension : CGFloat {
50+ if #available( macOS 26 . 0 , * ) { return Theme . cornerRadius }
51+ return 0
52+ }
53+
4954 init ( ) {
5055 let panel = BarPanel (
5156 contentRect: NSRect ( x: 0 , y: 0 , width: 800 , height: 360 ) ,
@@ -63,7 +68,29 @@ final class BarWindowController: NSWindowController, NSWindowDelegate {
6368 // Without this a stray close() would deallocate the panel and leave `window`
6469 // nil, which is another way to never show the bar again.
6570 panel. isReleasedWhenClosed = false
66- panel. contentView = NSHostingView ( rootView: BarView ( ) )
71+ let content = NSHostingView ( rootView: BarView ( ) )
72+ if #available( macOS 26 . 0 , * ) {
73+ let glassContent = NSView ( )
74+ content. translatesAutoresizingMaskIntoConstraints = false
75+ glassContent. addSubview ( content)
76+ NSLayoutConstraint . activate ( [
77+ content. leadingAnchor. constraint ( equalTo: glassContent. leadingAnchor) ,
78+ content. trailingAnchor. constraint ( equalTo: glassContent. trailingAnchor) ,
79+ content. topAnchor. constraint ( equalTo: glassContent. topAnchor) ,
80+ content. bottomAnchor. constraint ( equalTo: glassContent. bottomAnchor,
81+ constant: - Theme. cornerRadius) ,
82+ ] )
83+
84+ let glass = NSGlassEffectView ( )
85+ glass. contentView = glassContent
86+ glass. cornerRadius = Theme . cornerRadius
87+ glass. tintColor = NSColor . black. withAlphaComponent ( 0.12 )
88+ glass. style = . regular
89+ panel. contentView = glass
90+ panel. hasShadow = false
91+ } else {
92+ panel. contentView = content
93+ }
6794 super. init ( window: panel)
6895 panel. delegate = self
6996 }
@@ -128,16 +155,19 @@ final class BarWindowController: NSWindowController, NSWindowDelegate {
128155 // flew across the bezel. A view clipped to the window can never escape it.
129156 panel. setFrame ( onScreen, display: false )
130157 guard let content = panel. contentView else { return }
158+ let bottomExtension = Self . contentBottomExtension
159+ let contentHeight = height + bottomExtension
131160 content. autoresizingMask = [ ]
132- content. frame = NSRect ( x: 0 , y: - height, width: onScreen. width, height: height)
161+ content. frame = NSRect ( x: 0 , y: - contentHeight,
162+ width: onScreen. width, height: contentHeight)
133163
134164 let token = beginTransition ( )
135165 phase = . showing( token)
136166
137167 NSApp . activate ( ignoringOtherApps: true )
138168 panel. makeKeyAndOrderFront ( nil )
139169
140- let finish = { [ weak self] in
170+ let finish : @ MainActor @ Sendable ( ) -> Void = { [ weak self] in
141171 guard let self else { return }
142172 self . settle ( token) {
143173 self . phase = . shown
@@ -152,7 +182,8 @@ final class BarWindowController: NSWindowController, NSWindowDelegate {
152182 NSAnimationContext . runAnimationGroup ( { ctx in
153183 ctx. duration = Self . showDuration
154184 ctx. timingFunction = CAMediaTimingFunction ( name: . easeOut)
155- content. animator ( ) . frame = NSRect ( x: 0 , y: 0 , width: onScreen. width, height: height)
185+ content. animator ( ) . frame = NSRect ( x: 0 , y: - bottomExtension,
186+ width: onScreen. width, height: contentHeight)
156187 } , completionHandler: { DispatchQueue . main. async ( execute: finish) } )
157188 DispatchQueue . main. asyncAfter ( deadline: . now( ) + Self. showDuration + 0.05 , execute: finish)
158189 }
@@ -166,7 +197,7 @@ final class BarWindowController: NSWindowController, NSWindowDelegate {
166197 let down = NSRect ( x: 0 , y: - content. frame. height,
167198 width: content. frame. width, height: content. frame. height)
168199
169- let finish = { [ weak self] in
200+ let finish : @ MainActor @ Sendable ( ) -> Void = { [ weak self] in
170201 guard let self else { return }
171202 self . settle ( token) {
172203 panel. orderOut ( nil )
0 commit comments