From f93c41669ebea2102b30838a3a4967c87353cac9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 3 Jan 2024 12:10:52 -0800 Subject: [PATCH] macos: order main window front on restore --- macos/Sources/Features/Terminal/TerminalRestorable.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macos/Sources/Features/Terminal/TerminalRestorable.swift b/macos/Sources/Features/Terminal/TerminalRestorable.swift index c80818b0a..7b70220b4 100644 --- a/macos/Sources/Features/Terminal/TerminalRestorable.swift +++ b/macos/Sources/Features/Terminal/TerminalRestorable.swift @@ -125,6 +125,13 @@ class TerminalWindowRestoration: NSObject, NSWindowRestoration { guard viewWindow == inWindow else { return } inWindow.makeFirstResponder(to) + + // If the window is main, then we also make sure it comes forward. This + // prevents a bug found in #1177 where sometimes on restore the windows + // would be behind other applications. + if (viewWindow.isMainWindow) { + viewWindow.orderFront(nil) + } } } }