diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 259d853..95a4000 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -341,8 +341,11 @@ begin // the password into it. Then pop the modal in fill mode. if not FServer.Active then Exit; FAutofillTargetHWND := ATargetHWND; - LWasHidden := (not Self.Visible) or - IsIconic(WindowHandleToPlatform(Self.Handle).Wnd); + // Tray-hidden ONLY (Visible=false). A window merely minimised to the + // taskbar must NOT count: hide-after would send it to the TRAY on close — + // it vanishes from the taskbar it came from. Restored-from-iconic just + // stays open after the modal closes. + LWasHidden := not Self.Visible; FBridge.RestoreFromTray; LWasHiddenJs := BoolToStr(LWasHidden, True).ToLower; // Second arg forFill=true tells JS to SendInput on pick instead of copy. @@ -362,11 +365,11 @@ begin // see the modal, then ask JS to open it. JS handles the locked-vault // case (shows the auth screen with master-pw focused instead). if not FServer.Active then Exit; - // Remember whether the window was hidden BEFORE we restore — after the - // user picks an entry the JS layer asks us to minimize back so they can - // paste into the target app without an extra alt-tab. - LWasHidden := (not Self.Visible) or - IsIconic(WindowHandleToPlatform(Self.Handle).Wnd); + // Remember whether the window was TRAY-hidden BEFORE we restore — after + // the user picks an entry the JS layer asks us to minimize back so they + // can paste into the target app without an extra alt-tab. Iconic-only + // (taskbar) does NOT count — see BridgeQuickSearchHotkey. + LWasHidden := not Self.Visible; FBridge.RestoreFromTray; LWasHiddenJs := BoolToStr(LWasHidden, True).ToLower; WebBrowser.ExecuteJavaScript(