diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index c60c2fab7..64eac02d1 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -344,14 +344,15 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr confirmUndo: Bool = true, inheritBackgroundOpacity: Bool? = nil ) -> TerminalController { + // Calculate the target frame based on the tree's view bounds + // before moving into the new window + let treeSize: CGSize? = tree.root?.viewBounds() + let c = TerminalController.init(ghostty, withSurfaceTree: tree) if let inheritBackgroundOpacity { c.isBackgroundOpaque = inheritBackgroundOpacity } - // Calculate the target frame based on the tree's view bounds - let treeSize: CGSize? = tree.root?.viewBounds() - c.scheduleInitialPresentation { c.showWindow(self) if let window = c.window {