diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 77eb079ad..c5e1c413f 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -11,6 +11,13 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr guard let appDelegate = NSApp.delegate as? AppDelegate else { return defaultValue } let config = appDelegate.ghostty.config + + // If we have no window decorations, there's no reason to do anything but + // the default titlebar (because there will be no titlebar). + if !config.windowDecorations { + return defaultValue + } + let nib = switch config.macosTitlebarStyle { case "native": "Terminal" case "hidden": "TerminalHiddenTitlebar" diff --git a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift index f9dfb9591..cec85f06e 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift @@ -58,16 +58,19 @@ class TerminalWindow: NSWindow { hideWindowButtons() } - // Create our reset zoom titlebar accessory. - resetZoomAccessory.layoutAttribute = .right - resetZoomAccessory.view = NSHostingView(rootView: ResetZoomAccessoryView( - viewModel: viewModel, - action: { [weak self] in - guard let self else { return } - self.terminalController?.splitZoom(self) - })) - addTitlebarAccessoryViewController(resetZoomAccessory) - resetZoomAccessory.view.translatesAutoresizingMaskIntoConstraints = false + // Create our reset zoom titlebar accessory. We have to have a title + // to do this or AppKit triggers an assertion. + if styleMask.contains(.titled) { + resetZoomAccessory.layoutAttribute = .right + resetZoomAccessory.view = NSHostingView(rootView: ResetZoomAccessoryView( + viewModel: viewModel, + action: { [weak self] in + guard let self else { return } + self.terminalController?.splitZoom(self) + })) + addTitlebarAccessoryViewController(resetZoomAccessory) + resetZoomAccessory.view.translatesAutoresizingMaskIntoConstraints = false + } // Setup the accessory view for tabs that shows our keyboard shortcuts, // zoomed state, etc. Note I tried to use SwiftUI here but ran into issues