From 768e94defe5facf31bfb66c8b907c16d98c2e25f Mon Sep 17 00:00:00 2001 From: Eric bower Date: Tue, 20 Jan 2026 13:56:07 -0500 Subject: [PATCH] fix: check if tab is part of the fullscreen group --- .../Terminal/BaseTerminalController.swift | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index c1681338a..16aff39a9 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -512,20 +512,23 @@ class BaseTerminalController: NSWindowController, // For fullscreen windows with tabs, force a relayout on all tabs. // After a monitor disconnect, the window frames become stale. Cycling - // through tabs fixes this, so we simulate that by ordering each window. + // through tabs fixes this, so we simulate that by changing the selected tab. if window.styleMask.contains(.fullScreen) { if let tabGroup = window.tabGroup, tabGroup.windows.count > 1 { DispatchQueue.main.async { - // Remember the current main window - let currentMain = window - - // Briefly make each background tab key to trigger layout recalculation - for tabWindow in tabGroup.windows where tabWindow != currentMain { - tabWindow.makeKeyAndOrderFront(nil) + // Remember the current selected window + let originalSelected = tabGroup.selectedWindow + + // Briefly select each tab to trigger layout recalculation + // Only cycle through tabs that have the fullscreen style mask + for tabWindow in tabGroup.windows where tabWindow != originalSelected && tabWindow.styleMask.contains(.fullScreen) { + tabGroup.selectedWindow = tabWindow + } + + // Restore the original selection + if let originalSelected { + tabGroup.selectedWindow = originalSelected } - - // Restore the original window as key - currentMain.makeKeyAndOrderFront(nil) } } return