Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 50 additions & 14 deletions Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2581,7 +2598,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
syncMenuBarExtraVisibility()
updateController.startUpdaterIfNeeded()
}
titlebarAccessoryController.start()
if #available(macOS 26.0, *) {
// On macOS 26, native SwiftUI .toolbar handles titlebar controls.
} else {
titlebarAccessoryController.start()
}
windowDecorationsController.start()
installMainWindowKeyObserver()
refreshGhosttyGotoSplitShortcuts()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -10119,6 +10150,11 @@ 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 the old titlebar accessory controllers.
return
}
titlebarAccessoryController.start()
titlebarAccessoryController.attach(to: window)
}
Comment on lines 10152 to 10162
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Bell button is a no-op on macOS 26

attachUpdateAccessory(to:) returns early without calling titlebarAccessoryController.start() or .attach(to:), and applicationDidFinishLaunching also skips .start() on macOS 26 (~line 2601). As a result controlsControllers.allObjects is always empty. When the SwiftUI toolbar bell calls AppDelegate.shared?.toggleNotificationsPopover(animated: true), UpdateTitlebarAccessoryController.toggleNotificationsPopover bails immediately on guard !controllers.isEmpty else { return } — clicking the bell silently does nothing.

Fix: either call titlebarAccessoryController.start() (without attach) so the popover infrastructure is initialized, or route the bell action through a macOS-26-specific popover path that does not depend on controlsControllers.

Expand Down
Loading
Loading