From 54c82f27324bf14ac22a7c0b1cb1dc69cd95e42d Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 16 Sep 2025 15:12:02 -0700 Subject: [PATCH] Windows: Unminimize a window when activating it (#38287) Closes #36287 Release Notes: - Windows: Fixed an issue where a Zed window would stay minimized when opening an existing file in that window via the Zed CLI. --- crates/gpui/src/platform/windows/window.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index aa907c8d734973fc4fc795b6d8ebf7654d1b40de..7abb4ee21a1a28356e15d09be3c22c688bb7e033 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -684,8 +684,16 @@ impl PlatformWindow for WindowsWindow { .executor .spawn(async move { this.set_window_placement().log_err(); - unsafe { SetActiveWindow(hwnd).log_err() }; - unsafe { SetFocus(Some(hwnd)).log_err() }; + + unsafe { + // If the window is minimized, restore it. + if IsIconic(hwnd).as_bool() { + ShowWindowAsync(hwnd, SW_RESTORE).ok().log_err(); + } + + SetActiveWindow(hwnd).log_err(); + SetFocus(Some(hwnd)).log_err(); + } // premium ragebait by windows, this is needed because the window // must have received an input event to be able to set itself to foreground