Color after setting window theme and tab mode

This commit is contained in:
Troels Thomsen
2024-05-20 10:22:27 +02:00
parent 57e33319a3
commit 242858b963

View File

@ -259,13 +259,6 @@ class TerminalController: NSWindowController, NSWindowDelegate,
// when cascading.
window.center()
// Set the background color of the window
let backgroundColor = NSColor(ghostty.config.backgroundColor)
window.backgroundColor = backgroundColor
// This makes sure our titlebar renders correctly when there is a transparent background
window.titlebarColor = backgroundColor.withAlphaComponent(ghostty.config.backgroundOpacity)
// Make sure our theme is set on the window so styling is correct.
if let windowTheme = ghostty.config.windowTheme {
window.windowTheme = .init(rawValue: windowTheme)
@ -282,6 +275,13 @@ class TerminalController: NSWindowController, NSWindowDelegate,
}
}
// Set the background color of the window
let backgroundColor = NSColor(ghostty.config.backgroundColor)
window.backgroundColor = backgroundColor
// This makes sure our titlebar renders correctly when there is a transparent background
window.titlebarColor = backgroundColor.withAlphaComponent(ghostty.config.backgroundOpacity)
// Initialize our content view to the SwiftUI root
window.contentView = NSHostingView(rootView: TerminalView(
ghostty: self.ghostty,