-
-
Notifications
You must be signed in to change notification settings - Fork 957
Adopt macOS 26 Liquid Glass design #2647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
10f2d7a
1951e3a
2c3e61d
65db12c
eba5d8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,20 +11,37 @@ import Darwin | |
|
|
||
| final class MainWindowHostingView<Content: View>: NSHostingView<Content> { | ||
| private let zeroSafeAreaLayoutGuide = NSLayoutGuide() | ||
| private let usesSystemSafeArea: Bool | ||
|
|
||
| override var safeAreaInsets: NSEdgeInsets { NSEdgeInsetsZero } | ||
| override var safeAreaRect: NSRect { bounds } | ||
| override var safeAreaLayoutGuide: NSLayoutGuide { zeroSafeAreaLayoutGuide } | ||
| override var safeAreaInsets: NSEdgeInsets { | ||
| usesSystemSafeArea ? super.safeAreaInsets : NSEdgeInsetsZero | ||
| } | ||
| override var safeAreaRect: NSRect { | ||
| usesSystemSafeArea ? super.safeAreaRect : bounds | ||
| } | ||
| override var safeAreaLayoutGuide: NSLayoutGuide { | ||
| usesSystemSafeArea ? super.safeAreaLayoutGuide : zeroSafeAreaLayoutGuide | ||
| } | ||
|
|
||
| required init(rootView: Content) { | ||
| if #available(macOS 26.0, *) { | ||
| // On macOS 26, use system safe area so: | ||
| // - Sidebar (.ignoresSafeArea) extends under the glass titlebar | ||
| // - Terminal content respects the titlebar and stays below it | ||
| self.usesSystemSafeArea = true | ||
| } else { | ||
| self.usesSystemSafeArea = false | ||
| } | ||
| super.init(rootView: rootView) | ||
| addLayoutGuide(zeroSafeAreaLayoutGuide) | ||
| NSLayoutConstraint.activate([ | ||
| zeroSafeAreaLayoutGuide.leadingAnchor.constraint(equalTo: leadingAnchor), | ||
| zeroSafeAreaLayoutGuide.trailingAnchor.constraint(equalTo: trailingAnchor), | ||
| zeroSafeAreaLayoutGuide.topAnchor.constraint(equalTo: topAnchor), | ||
| zeroSafeAreaLayoutGuide.bottomAnchor.constraint(equalTo: bottomAnchor), | ||
| ]) | ||
| if !usesSystemSafeArea { | ||
| addLayoutGuide(zeroSafeAreaLayoutGuide) | ||
| NSLayoutConstraint.activate([ | ||
| zeroSafeAreaLayoutGuide.leadingAnchor.constraint(equalTo: leadingAnchor), | ||
| zeroSafeAreaLayoutGuide.trailingAnchor.constraint(equalTo: trailingAnchor), | ||
| zeroSafeAreaLayoutGuide.topAnchor.constraint(equalTo: topAnchor), | ||
| zeroSafeAreaLayoutGuide.bottomAnchor.constraint(equalTo: bottomAnchor), | ||
| ]) | ||
| } | ||
| } | ||
|
|
||
| @available(*, unavailable) | ||
|
|
@@ -2581,6 +2598,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent | |
| syncMenuBarExtraVisibility() | ||
| updateController.startUpdaterIfNeeded() | ||
| } | ||
| // Start the titlebar accessory controller on all versions so the | ||
| // notifications popover infrastructure is available. On macOS 26 | ||
| // the visual titlebar items come from SwiftUI .toolbar, but the | ||
| // popover is still managed by the accessory controller. | ||
| titlebarAccessoryController.start() | ||
| windowDecorationsController.start() | ||
| installMainWindowKeyObserver() | ||
|
|
@@ -7084,10 +7105,20 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent | |
| window.collectionBehavior.insert(.fullScreenDisallowsTiling) | ||
| } | ||
| window.title = "" | ||
| window.titleVisibility = .hidden | ||
| window.titlebarAppearsTransparent = true | ||
| if #available(macOS 26.0, *) { | ||
| // On macOS 26+, let the system render the native glass titlebar | ||
| window.titleVisibility = .hidden | ||
| window.titlebarAppearsTransparent = false | ||
| } else { | ||
| window.titleVisibility = .hidden | ||
| window.titlebarAppearsTransparent = true | ||
| } | ||
| window.isMovableByWindowBackground = false | ||
| window.isMovable = false | ||
| if #available(macOS 26.0, *) { | ||
| window.isMovable = true | ||
| } else { | ||
| window.isMovable = false | ||
| } | ||
| let restoredFrame = resolvedWindowFrame(from: sessionWindowSnapshot) | ||
| if let restoredFrame { | ||
| window.setFrame(restoredFrame, display: false) | ||
|
|
@@ -10119,6 +10150,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent | |
| #endif | ||
|
|
||
| func attachUpdateAccessory(to window: NSWindow) { | ||
| if #available(macOS 26.0, *) { | ||
| // On macOS 26, toolbar buttons are native SwiftUI .toolbar items | ||
| // in the NavigationSplitView. Skip attaching the old titlebar | ||
| // accessory views, but the controller is already started (for | ||
| // notifications popover support). | ||
| return | ||
| } | ||
| titlebarAccessoryController.start() | ||
| titlebarAccessoryController.attach(to: window) | ||
| } | ||
|
|
@@ -10127,7 +10165,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent | |
| windowDecorationsController.apply(to: window) | ||
| } | ||
|
|
||
| /// Notification posted on macOS 26 to toggle the SwiftUI notifications popover. | ||
| static let toggleNotificationsPopoverNotification = Notification.Name("cmux.toggleNotificationsPopover") | ||
|
|
||
| func toggleNotificationsPopover(animated: Bool = true, anchorView: NSView? = nil) { | ||
| if #available(macOS 26.0, *) { | ||
| NotificationCenter.default.post(name: Self.toggleNotificationsPopoverNotification, object: nil) | ||
| return | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notification popover broadcast toggles all windows simultaneouslyMedium Severity On macOS 26, Additional Locations (1)Reviewed by Cursor Bugbot for commit eba5d8c. Configure here. |
||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notifications popover state queries broken on macOS 26High Severity On macOS 26, Reviewed by Cursor Bugbot for commit eba5d8c. Configure here. |
||
| titlebarAccessoryController.toggleNotificationsPopover(animated: animated, anchorView: anchorView) | ||
|
Comment on lines
+10168
to
10176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scope and complete the macOS 26 notifications presenter. This bridge only emits a global toggle and drops the originating window. The SwiftUI side therefore has no deterministic target window, and the explicit show/dismiss/state entry points in this file ( 🛠️ Suggested direction /// Notification posted on macOS 26 to toggle the SwiftUI notifications popover.
static let toggleNotificationsPopoverNotification = Notification.Name("cmux.toggleNotificationsPopover")
+ static let showNotificationsPopoverNotification = Notification.Name("cmux.showNotificationsPopover")
+ static let dismissNotificationsPopoverNotification = Notification.Name("cmux.dismissNotificationsPopover")
+ static let notificationsPopoverWindowIdUserInfoKey = "windowId"
func toggleNotificationsPopover(animated: Bool = true, anchorView: NSView? = nil) {
if `#available`(macOS 26.0, *) {
- NotificationCenter.default.post(name: Self.toggleNotificationsPopoverNotification, object: nil)
+ guard
+ let window = anchorView?.window ?? NSApp.keyWindow ?? NSApp.mainWindow,
+ let windowId = mainWindowId(for: window)
+ else { return }
+ NotificationCenter.default.post(
+ name: Self.toggleNotificationsPopoverNotification,
+ object: window,
+ userInfo: [Self.notificationsPopoverWindowIdUserInfoKey: windowId]
+ )
return
}
titlebarAccessoryController.toggleNotificationsPopover(animated: animated, anchorView: anchorView)
}Then route 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attachUpdateAccessory(to:)returns early without callingtitlebarAccessoryController.start()or.attach(to:), andapplicationDidFinishLaunchingalso skips.start()on macOS 26 (~line 2601). As a resultcontrolsControllers.allObjectsis always empty. When the SwiftUI toolbar bell callsAppDelegate.shared?.toggleNotificationsPopover(animated: true),UpdateTitlebarAccessoryController.toggleNotificationsPopoverbails immediately onguard !controllers.isEmpty else { return }— clicking the bell silently does nothing.Fix: either call
titlebarAccessoryController.start()(withoutattach) so the popover infrastructure is initialized, or route the bell action through a macOS-26-specific popover path that does not depend oncontrolsControllers.