mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Extract guard statement
This commit is contained in:

committed by
Troels Thomsen

parent
242858b963
commit
47874742a1
@ -136,14 +136,8 @@ class TerminalWindow: NSWindow {
|
|||||||
|
|
||||||
updateResetZoomTitlebarButtonVisibility()
|
updateResetZoomTitlebarButtonVisibility()
|
||||||
|
|
||||||
// The remainder of the styles we only apply if we're on "auto" theming
|
// The remainder of this function only applies to styled tabs.
|
||||||
// because they conflict with the appearance being forced a certain
|
guard hasStyledTabs else { return }
|
||||||
// direction. Titlebar tabs are excluded (they always style the titlebar)
|
|
||||||
// because historically this is how they've always worked. So this
|
|
||||||
// exclusion only applies to native tabs. See issue #1709.
|
|
||||||
if let windowTheme, windowTheme != .auto && !titlebarTabs {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
titlebarSeparatorStyle = tabbedWindows != nil && !titlebarTabs ? .line : .none
|
titlebarSeparatorStyle = tabbedWindows != nil && !titlebarTabs ? .line : .none
|
||||||
|
|
||||||
@ -177,6 +171,20 @@ class TerminalWindow: NSWindow {
|
|||||||
|
|
||||||
// MARK: - Tab Bar Styling
|
// MARK: - Tab Bar Styling
|
||||||
|
|
||||||
|
// This is true if we should apply styles to the titlebar or tab bar.
|
||||||
|
var hasStyledTabs: Bool {
|
||||||
|
// If we have titlebar tabs then we always style.
|
||||||
|
guard !titlebarTabs else { return true }
|
||||||
|
|
||||||
|
// This should never happen, but if we don't have a theme set then
|
||||||
|
// we just style the tabs. Either response here is probably okay.
|
||||||
|
guard let windowTheme else { return true }
|
||||||
|
|
||||||
|
// We only style if the window theme is auto. Any other specific
|
||||||
|
// window theme type will always show up as that native theme.
|
||||||
|
return windowTheme == .auto
|
||||||
|
}
|
||||||
|
|
||||||
var hasVeryDarkBackground: Bool {
|
var hasVeryDarkBackground: Bool {
|
||||||
backgroundColor.luminance < 0.05
|
backgroundColor.luminance < 0.05
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user