From 9f8d573a19188e2c2e62f0af0063317703bb5301 Mon Sep 17 00:00:00 2001 From: uzair-coder07 Date: Mon, 23 Feb 2026 17:38:43 -0600 Subject: [PATCH 1/2] fix: show sign-in window on launch when not authenticated When Coder Desktop launches and the user is not signed in, the app now automatically opens the sign-in window instead of silently minimizing to the system tray. This gives new users a clear next step and confirms the app is running. Previously, a fresh install produced no visible window or taskbar entry, requiring users to discover the system tray icon to find the sign-in prompt. This led users to believe the application failed to start. When already authenticated, the existing behavior (going silently to the system tray) is preserved. Fixes coder/coder-desktop-windows#164 --- App/App.xaml.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/App/App.xaml.cs b/App/App.xaml.cs index aef0d1c..fdf7c7b 100644 --- a/App/App.xaml.cs +++ b/App/App.xaml.cs @@ -258,6 +258,19 @@ private async Task InitializeServicesAsync(CancellationToken cancellationToken = { _logger.LogError($"Failed to refresh sync session state {ex.Message}", ex); } + + // If the user is not signed in, automatically show the sign-in window. + // This ensures new users see a clear next step instead of the app + // silently minimizing to the system tray. + var credentialModel = credentialManager.GetCachedCredentials(); + if (credentialModel.State == CredentialState.Invalid) + { + TrayWindow?.DispatcherQueue.TryEnqueue(() => + { + var signInWindow = _services.GetRequiredService(); + signInWindow.Activate(); + }); + } } public void OnActivated(object? sender, AppActivationArguments args) From 3ccfe3a08d3374416e0f66f9735497c61fbe917a Mon Sep 17 00:00:00 2001 From: uzair-coder07 Date: Tue, 24 Feb 2026 09:39:05 -0600 Subject: [PATCH 2/2] fix: show sign-in window on first launch when not authenticated On first launch, if the user is not signed in, automatically open the sign-in window instead of silently minimizing to the system tray. This gives new users a clear next step and confirms the app is running. A marker file (.sign-in-prompt-shown) is written to the app's data directory after the window is shown, so it only appears once. Subsequent launches fall back to the existing silent tray behavior even if the user remains signed out. Fixes coder/coder-desktop-windows#164 --- App/App.xaml.cs | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/App/App.xaml.cs b/App/App.xaml.cs index fdf7c7b..fa0a8e0 100644 --- a/App/App.xaml.cs +++ b/App/App.xaml.cs @@ -259,20 +259,44 @@ private async Task InitializeServicesAsync(CancellationToken cancellationToken = _logger.LogError($"Failed to refresh sync session state {ex.Message}", ex); } - // If the user is not signed in, automatically show the sign-in window. - // This ensures new users see a clear next step instead of the app - // silently minimizing to the system tray. - var credentialModel = credentialManager.GetCachedCredentials(); - if (credentialModel.State == CredentialState.Invalid) + // If the user is not signed in and we haven't shown the sign-in + // window before, show it automatically. This ensures new users see a + // clear next step on first launch instead of the app silently + // minimizing to the system tray. A marker file is written so the + // window is only shown once. + try { - TrayWindow?.DispatcherQueue.TryEnqueue(() => + var credentialModel = credentialManager.GetCachedCredentials(); + if (credentialModel.State == CredentialState.Invalid && !SignInPromptMarkerExists()) { - var signInWindow = _services.GetRequiredService(); - signInWindow.Activate(); - }); + WriteSignInPromptMarker(); + TrayWindow?.DispatcherQueue.TryEnqueue(() => + { + var signInWindow = _services.GetRequiredService(); + signInWindow.Activate(); + }); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to show sign-in window on first launch"); } + } + private static string SignInPromptMarkerPath => Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "CoderDesktop", + ".sign-in-prompt-shown"); + + private static bool SignInPromptMarkerExists() => File.Exists(SignInPromptMarkerPath); + + private static void WriteSignInPromptMarker() + { + Directory.CreateDirectory(Path.GetDirectoryName(SignInPromptMarkerPath)!); + File.WriteAllBytes(SignInPromptMarkerPath, Array.Empty()); + } + public void OnActivated(object? sender, AppActivationArguments args) { switch (args.Kind)