From e7f58ad72e8fd32b59e60660cb8430fdc59d0ddd Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:41:53 +0000 Subject: [PATCH] macOS: double click title to enlarge window Previously with `macos-titlebar-style = tabs`, double clicking title will do nothing --- macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift | 11 +++++++++-- macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift | 5 +++++ 2 file(s) changed, 14 insertion(s)(+), 2 deletion(s)(-) diff --git a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift --- a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift @@ -241,11 +241,11 @@ switch itemIdentifier { case .title: let item = NSToolbarItem(itemIdentifier: .title) - item.view = NSHostingView(rootView: TitleItem(viewModel: viewModel)) + item.view = ClickThroughHostingView(rootView: TitleItem(viewModel: viewModel)) // Fix: https://github.com/ghostty-org/ghostty/discussions/9027 item.view?.setContentCompressionResistancePriority(.required, for: .horizontal) item.visibilityPriority = .user - item.isEnabled = true + item.isEnabled = false // This is the documented way to avoid the glass view on an item. // We don't want glass on our title. @@ -306,5 +306,12 @@ .frame(maxWidth: .greatestFiniteMagnitude, alignment: .center) .opacity(viewModel.hasTabBar ? 0 : 1) // hide when in fullscreen mode, where title bar will appear in the leading area under window buttons } + } +} + +/// A "Ghosting" Hosting View, that acts like it's not there +private class ClickThroughHostingView: NSHostingView { + override func hitTest(_ point: NSPoint) -> NSView? { + nil } } diff --git a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift --- a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift @@ -689,6 +689,11 @@ setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) } + /// Click through, so we can double click here to enlarge current window + override func hitTest(_ point: NSPoint) -> NSView? { + nil + } + // Vertically center the text override func draw(_ dirtyRect: NSRect) { guard let attributedString = self.attributedStringValue.mutableCopy() as? NSMutableAttributedString else { -- tangled.sh