macOS: Simplify native title hiding logic for titlebar tabs.

This commit is contained in:
Qwerasd
2024-02-04 16:55:18 -05:00
parent 4d335a220f
commit fdab397c61

View File

@ -45,19 +45,10 @@ class TerminalWindow: NSWindow {
self.toolbar = TerminalToolbar(identifier: "Toolbar") self.toolbar = TerminalToolbar(identifier: "Toolbar")
} }
// We directly hide the view containing the title text because if we use the // We have to wait before setting the titleVisibility or else it prevents
// `titleVisibility` property for this it prevents the window from hiding the // the window from hiding the tab bar when we get down to a single tab.
// tab bar when we get down to a single tab. DispatchQueue.main.async {
if let toolbarTitleView = contentView?.superview?.subviews.first(where: { self.titleVisibility = .hidden
$0.className == "NSTitlebarContainerView"
})?.subviews.first(where: {
$0.className == "NSTitlebarView"
})?.subviews.first(where: {
$0.className == "NSToolbarView"
})?.subviews.first(where: {
$0.className == "NSToolbarTitleView"
}) {
toolbarTitleView.isHidden = true
} }
} else { } else {
// "expanded" places the toolbar below the titlebar, so setting this style and // "expanded" places the toolbar below the titlebar, so setting this style and