mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
macOS: double click title to enlarge window (#12219)
Previously with `macos-titlebar-style = tabs`, double clicking title would do nothing
This commit is contained in:
@@ -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<Content: View>: NSHostingView<Content> {
|
||||
override func hitTest(_ point: NSPoint) -> NSView? {
|
||||
nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user