From 67bc9fa0bc7eea61c206aa63b191f68b8989aa0f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 24 Oct 2024 21:06:32 -0700 Subject: [PATCH] macos: nuke the titlebar from orbit when hidden --- .../Features/Terminal/BaseTerminalController.swift | 4 ++-- macos/Sources/Features/Terminal/TerminalController.swift | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index 6e4807c1a..432345627 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -235,12 +235,12 @@ class BaseTerminalController: NSWindowController, // Set the main window title window.title = to - + } func pwdDidChange(to: URL?) { guard let window else { return } - + if ghostty.config.macosTitlebarProxyIcon == .visible { // Use the 'to' URL directly window.representedURL = to diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 0b1ff3b72..c22ac7042 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -310,6 +310,14 @@ class TerminalController: BaseTerminalController { // Disallow tabbing if the titlebar is hidden, since that will (should) also hide the tab bar. window.tabbingMode = .disallowed + + // Nuke it from orbit -- hide the titlebar container entirely, just in case. There are + // some operations that appear to bring back the titlebar visibility so this ensures + // it is gone forever. + if let themeFrame = window.contentView?.superview, + let titleBarContainer = themeFrame.firstDescendant(withClassName: "NSTitlebarContainerView") { + titleBarContainer.isHidden = true + } } // In various situations, macOS automatically tabs new windows. Ghostty handles