From e7f58ad72e8fd32b59e60660cb8430fdc59d0ddd Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:41:53 +0200 Subject: [PATCH] macOS: double click title to enlarge window Previously with `macos-titlebar-style = tabs`, double clicking title will do nothing --- .../TitlebarTabsTahoeTerminalWindow.swift | 11 +++++++++-- .../TitlebarTabsVenturaTerminalWindow.swift | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift index 2bf3bd42f..6cbd891bf 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift @@ -241,11 +241,11 @@ class TitlebarTabsTahoeTerminalWindow: TransparentTitlebarTerminalWindow, NSTool 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. @@ -308,3 +308,10 @@ extension TitlebarTabsTahoeTerminalWindow { } } } + +/// 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 index fe83fc5fd..905e88229 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TitlebarTabsVenturaTerminalWindow.swift @@ -689,6 +689,11 @@ private class CenteredDynamicLabel: NSTextField { 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 {