You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(windows): Hand typing back to the previous window when the quick message pill closes #1577
On Windows, when the quick message pill closes (Enter or Escape), typing should go back to the window you were in, the way it now does on macOS and X11 since #1566. If that window is gone, typing should go to the window in front.
Why
#1566 kept Windows on main's focus behavior and moved the Windows hand-back to its own PR. Today nothing hands the foreground window back on Windows when the pill closes.
Done when
On Windows, after Enter or Escape closes the pill, typing lands in the window that was in front before the pill opened.
If that window closed while the pill was open, typing goes to the window in front.
Clicking the pill still always takes the keyboard, and a sprite click with no pill open still leaves typing where it was.
A Windows scenario script on fidget's verification scripting system covers these cases, with fail-fast waits, and ships with the PR.
Follow-up from #1566. Related: #1572 (two displays).
#1587 merged (9c6a892). It's groundwork for this issue's scenario, not the hand-back itself.
On main now
Start-FidgetPiped in scripts/scenarios/wait-helpers.win.ps1 launches Fidget with stdout and stderr piped, so each trace line wakes Wait-OnChanges as Fidget writes it, instead of waiting for Windows to flush process.log.
Every Windows scenario and both verify-anchor-*-win.ps1 scripts launch through it, and test-wait-helpers.ps1 checks the pipe wake under Windows PowerShell 5.1 in CI.
Still open here (nothing below is done)
On Windows, Enter or Escape closing the pill hands typing back to the window that was in front, or to the window in front if that one closed.
Clicking the pill still always takes the keyboard, and a sprite click with no pill open leaves typing where it was.
The Windows scenario for these cases, built on the piped waits with 3 s caps, ships with that PR.
#1583 merged (2f1819f). It adds the tracing and the Windows scenario this fix needs, not the hand-back itself.
On main now
With FIDGET_TRACE_BUBBLE on, Windows Fidget prints an overlay: pill open SetForegroundWindow(...) line showing what the call returned and which window ended up in front, and each overlay prints overlay: <label> page loaded.
scripts/scenarios/chat-close-pill-type.win.ps1 checks four cases against a uniquely named Notepad file, with 3 s waits: a sprite click leaves typing in Notepad, hovering opens the pill and typing lands in it, Escape closes the pill, and clicking Notepad takes focus back from the pill.
Still open here
On Windows, Enter or Escape closing the pill hands typing back to the window that was in front, or to the window in front if that one closed. The scenario checks that Escape closes the pill, not where typing goes afterward.
Scenario cases for Enter, typing after close, the closed-window fallback, and clicking the pill to take the keyboard ship with the fix.
The scenario hasn't run live on a Windows desktop yet. That first run is what shows whether Windows refuses the pill the foreground.
scripts/scenarios/README.md still says chat-close-pill-type has "no Windows leaf yet" in the X11 paragraph. The fix PR should drop that line.
#1593 merged (83733db). It stops the hover-opened pill from closing itself on Windows, which this issue's hand-back needs first. It is not the hand-back itself.
On main now
A window blur in the overlay's page no longer closes the pill by itself. The page asks the new overlay_has_foreground command (on Windows, whether GetForegroundWindow() is the overlay; false elsewhere), and only a false answer runs windowBlurred. So WebView2's blur right after SetForegroundWindow no longer closes an empty, just-opened pill.
The pill's field takes the caret only after overlay_request_focus returns.
Under FIDGET_TRACE_BUBBLE, each window blur prints window blur foreground=<true|false>.
chat-close-pill-type.win.ps1 judges case 2 from the moment the pill opened, and case 4 waits for window blur foreground=false and the pill's closed line within 3 s of the click. The script's Notepad placement next to fullscreen apps, bring-to-front fallback, one-character-at-a-time typing and FAIL-on-error line also landed here.
The live Windows run at 7d527055 passed in 7.4 s (sprite click, hover and type, Escape, click-away).
Still open here
On Windows, Enter or Escape closing the pill hands typing back to the window that was in front, or to the window in front if that one closed.
Clicking the pill still always takes the keyboard, and a sprite click with no pill open leaves typing where it was.
Scenario cases for Enter, typing after close, the closed-window fallback, and clicking the pill.
scripts/scenarios/README.md still says chat-close-pill-type has "no Windows leaf yet".
All of these are in #1590, which was stacked on #1593 and is next.
#1590 merged (6e7e8f4). That's the Windows hand-back itself, so this is done.
On main now
When an overlay's last pill closes with Enter or Escape, Windows platform::hand_back_keyboard restores the window that was in front at pill-open, if Fidget's overlay still holds the foreground and that window still exists.
If that window closed, it steps aside to the frontmost visible window (skipping Fidget's own, minimized and cloaked windows). If the user already moved on, nothing moves.
overlay_request_focus remembers the foreground window right before SetForegroundWindow, skipping Fidget's own windows. The decision is the shared pill_focus::hand_back, same as macOS and X11.
chat-close-pill-type.win.ps1 covers sprite click (typing stays put), Escape and Enter (Restore, typing lands in Notepad), the closed-window fallback (StepAside), click-away (Stay), and clicking the pill (it takes the keyboard, then Escape hands it back). Every wait is 3 s from its trigger.
Activity
feat(windows): Add pill-open trace and Windows scenario for #1577
feat(windows): Add pill-open trace and Windows scenario for #1577
test(windows): Rebuild the pill-open scenario on the #1566 Notepad leaf
test(windows): Chain the pill scenario's startup on a page-loaded tra…
test(windows): Pill scenario reuses one WebView2 profile and drops it…
omesser commentedon Oct 17, 2026
#1587 merged (
9c6a892). It's groundwork for this issue's scenario, not the hand-back itself.On main now
Start-FidgetPipedinscripts/scenarios/wait-helpers.win.ps1launches Fidget with stdout and stderr piped, so each trace line wakesWait-OnChangesas Fidget writes it, instead of waiting for Windows to flushprocess.log.verify-anchor-*-win.ps1scripts launch through it, andtest-wait-helpers.ps1checks the pipe wake under Windows PowerShell 5.1 in CI.Still open here (nothing below is done)
Leaving this open.
— Cursor agent (P. Coder), on @omesser's behalf.
feat(windows): Add pill-open trace and Windows scenario for #1577
test(windows): Rebuild the pill-open scenario on the #1566 Notepad leaf
test(windows): Chain the pill scenario's startup on a page-loaded tra…
test(windows): Pill scenario reuses one WebView2 profile and drops it…
omesser commentedon Oct 17, 2026
#1583 merged (
2f1819f). It adds the tracing and the Windows scenario this fix needs, not the hand-back itself.On main now
FIDGET_TRACE_BUBBLEon, Windows Fidget prints anoverlay: pill open SetForegroundWindow(...)line showing what the call returned and which window ended up in front, and each overlay printsoverlay: <label> page loaded.scripts/scenarios/chat-close-pill-type.win.ps1checks four cases against a uniquely named Notepad file, with 3 s waits: a sprite click leaves typing in Notepad, hovering opens the pill and typing lands in it, Escape closes the pill, and clicking Notepad takes focus back from the pill.Still open here
scripts/scenarios/README.mdstill sayschat-close-pill-typehas "no Windows leaf yet" in the X11 paragraph. The fix PR should drop that line.Leaving this open.
— Cursor agent (P. Coder), on @omesser's behalf.
omesser commentedon Oct 18, 2026
#1593 merged (
83733db). It stops the hover-opened pill from closing itself on Windows, which this issue's hand-back needs first. It is not the hand-back itself.On main now
overlay_has_foregroundcommand (on Windows, whetherGetForegroundWindow()is the overlay; false elsewhere), and only a false answer runswindowBlurred. So WebView2's blur right afterSetForegroundWindowno longer closes an empty, just-opened pill.overlay_request_focusreturns.FIDGET_TRACE_BUBBLE, each window blur printswindow blur foreground=<true|false>.chat-close-pill-type.win.ps1judges case 2 from the moment the pill opened, and case 4 waits forwindow blur foreground=falseand the pill's closed line within 3 s of the click. The script's Notepad placement next to fullscreen apps, bring-to-front fallback, one-character-at-a-time typing and FAIL-on-error line also landed here.7d527055passed in 7.4 s (sprite click, hover and type, Escape, click-away).Still open here
scripts/scenarios/README.mdstill sayschat-close-pill-typehas "no Windows leaf yet".All of these are in #1590, which was stacked on #1593 and is next.
Leaving this open.
— Cursor agent (P. Coder), on @omesser's behalf.
omesser commentedon Oct 18, 2026
#1590 merged (
6e7e8f4). That's the Windows hand-back itself, so this is done.On main now
platform::hand_back_keyboardrestores the window that was in front at pill-open, if Fidget's overlay still holds the foreground and that window still exists.overlay_request_focusremembers the foreground window right beforeSetForegroundWindow, skipping Fidget's own windows. The decision is the sharedpill_focus::hand_back, same as macOS and X11.chat-close-pill-type.win.ps1covers sprite click (typing stays put), Escape and Enter (Restore, typing lands in Notepad), the closed-window fallback (StepAside), click-away (Stay), and clicking the pill (it takes the keyboard, then Escape hands it back). Every wait is 3 s from its trigger.b92365ec, 12.5 s, all cases ok (output in feat(windows): Keyboard hand-back for quick message pill #1590's comments).Done when
The stale "no Windows leaf yet" line in
scripts/scenarios/README.mdis still there; that's tracked in #1606.Closing as completed.
— Cursor agent (P. Coder), on @omesser's behalf.