diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift index de1ea903d..55b674fae 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift @@ -137,11 +137,9 @@ class QuickTerminalController: BaseTerminalController { } // Setup our content - window.contentView = TerminalViewContainer( - ghostty: self.ghostty, - viewModel: self, - delegate: self - ) + window.contentView = TerminalViewContainer { + TerminalView(ghostty: ghostty, viewModel: self, delegate: self) + } // Clear out our frame at this point, the fixup from above is complete. if let qtWindow = window as? QuickTerminalWindow { diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index c5c003459..ad01e2bed 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -1024,11 +1024,9 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr } // Initialize our content view to the SwiftUI root - window.contentView = TerminalViewContainer( - ghostty: self.ghostty, - viewModel: self, - delegate: self, - ) + window.contentView = TerminalViewContainer { + TerminalView(ghostty: ghostty, viewModel: self, delegate: self) + } // If we have a default size, we want to apply it. if let defaultSize { diff --git a/macos/Sources/Features/Terminal/TerminalViewContainer.swift b/macos/Sources/Features/Terminal/TerminalViewContainer.swift index 3473b49da..bbe20ba53 100644 --- a/macos/Sources/Features/Terminal/TerminalViewContainer.swift +++ b/macos/Sources/Features/Terminal/TerminalViewContainer.swift @@ -3,20 +3,15 @@ import SwiftUI /// Use this container to achieve a glass effect at the window level. /// Modifying `NSThemeFrame` can sometimes be unpredictable. -class TerminalViewContainer: NSView { +class TerminalViewContainer: NSView { private let terminalView: NSView /// Combined glass effect and inactive tint overlay view private var glassEffectView: NSView? private var derivedConfig: DerivedConfig? - init(ghostty: Ghostty.App, viewModel: ViewModel, delegate: (any TerminalViewDelegate)? = nil) { - self.derivedConfig = DerivedConfig(config: ghostty.config, preferredBackgroundColor: nil, cornerRadius: nil) - self.terminalView = NSHostingView(rootView: TerminalView( - ghostty: ghostty, - viewModel: viewModel, - delegate: delegate - )) + init(@ViewBuilder rootView: () -> Root) { + self.terminalView = NSHostingView(rootView: rootView()) super.init(frame: .zero) setup() } diff --git a/macos/Sources/Helpers/Extensions/NSWindow+Extension.swift b/macos/Sources/Helpers/Extensions/NSWindow+Extension.swift index b9b48865d..e57bba1be 100644 --- a/macos/Sources/Helpers/Extensions/NSWindow+Extension.swift +++ b/macos/Sources/Helpers/Extensions/NSWindow+Extension.swift @@ -106,7 +106,6 @@ extension NSWindow { } } - // MARK: - Internal Properties extension NSWindow {