From abd7401a78f166f7beb83d6e1eeb38099fb3ae49 Mon Sep 17 00:00:00 2001 From: Eduard Gert Date: Mon, 13 Jul 2026 11:36:57 +0200 Subject: [PATCH] [client] Suppress browser-login:cancel on programmatic close --- client/ui/services/windowmanager.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/ui/services/windowmanager.go b/client/ui/services/windowmanager.go index 7af57b0dd..81c588925 100644 --- a/client/ui/services/windowmanager.go +++ b/client/ui/services/windowmanager.go @@ -193,13 +193,18 @@ func (s *WindowManager) OpenBrowserLogin(uri string) { opts.Screen = s.getScreenBasedOnCursorPosition() s.browserLogin = s.app.Window.NewWithOptions(opts) bl := s.browserLogin - // Red-X close means cancel: emit the event so startLogin() tears down the SSO wait. bl.OnWindowEvent(events.Common.WindowClosing, func(_ *application.WindowEvent) { - s.app.Event.Emit(EventBrowserLoginCancel) s.mu.Lock() + // Programmatic closers (CloseBrowserLogin/CloseRenewFlow) nil s.browserLogin + // before calling Close(); only a user red-X still has it set here + userClosed := s.browserLogin == bl s.browserLogin = nil s.restoreHiddenWindowsLocked() s.mu.Unlock() + // Emit event only when user closed the window + if userClosed { + s.app.Event.Emit(EventBrowserLoginCancel) + } }) s.centerOnCursorScreen(s.browserLogin) return