From b4a5ddfef966f8def62864f901b0d9cec608fd82 Mon Sep 17 00:00:00 2001 From: Suyeol Jeon Date: Thu, 18 Dec 2025 17:13:02 +0900 Subject: [PATCH] macos: apply window position after setting content size When window-width/height is configured, the window size is set via setContentSize in windowDidLoad. However, window-position-x/y was not being applied after this resize, causing the window to appear at an incorrect position. This was a regression introduced in c75bade89 which refactored the default size logic from a computed NSRect property to a DefaultSize enum. The original code called adjustForWindowPosition after calculating the frame, but this was lost during the refactoring. Fixes the issue by calling adjustForWindowPosition after applying contentIntrinsicSize to ensure window position is correctly set. --- macos/Sources/Features/Terminal/TerminalController.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 8a0c5f46d..bccdd9c69 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -952,9 +952,13 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr case .contentIntrinsicSize: // Content intrinsic size requires a short delay so that AppKit // can layout our SwiftUI views. - DispatchQueue.main.asyncAfter(deadline: .now() + .microseconds(10_000)) { [weak window] in - guard let window else { return } + DispatchQueue.main.asyncAfter(deadline: .now() + .microseconds(10_000)) { [weak self, weak window] in + guard let self, let window else { return } defaultSize.apply(to: window) + if let screen = window.screen ?? NSScreen.main { + let frame = self.adjustForWindowPosition(frame: window.frame, on: screen) + window.setFrameOrigin(frame.origin) + } } } }