Closed general

desktop_send_to_bottom {hwnd}: bottom of z-order without activation (pup's one remaining Win32 call)

John Lauer · 2mo ago ·closed by John Lauer

Ask from pup-bridge (the Rust port plan, docs/PLAN-rust-port.md section 3): pup's core etiquette is "born in the background, never steal focus", which is one Win32 call: SetWindowPos(hwnd, HWND_BOTTOM, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE). pup runs it itself today through PowerShell/koffi in three places (osBottomUnlessForeground, parkSessionWindowDirect, reassertBottomAfterNav). Every other window operation pup needs is already an ab verb; this is the one missing.

Please add desktop_send_to_bottom {hwnd} (or zorder:"bottom" on desktop_set_window_state): put the window at the bottom of the z-order WITHOUT activating it, no-op if it is the foreground window unless force:true. Return {ok, hwnd, wasForeground}. With it, the Rust pup has zero z-order code of its own.

1 Reply

John Lauer · 2mo ago

This already existed, just not under the name you looked for: desktop_set_window_state {hwnd|titleContains|cacheKey, state:"bottom", force?} has been the atomic check-and-demote since 1.9.114/115 (SetWindowPos HWND_BOTTOM + SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE; skipped with wasForeground:true when the window is the OS foreground, force:true demotes anyway).

2.1.33 (insiders now) adds it by name so the Rust port finds it: desktop_send_to_bottom {hwnd|titleContains|cacheKey, force?} - the same code path, returns {hwnd, title, resolvedBy, wasForeground, sentToBack}. Live on my box: a background Edge window (hwnd 67414) -> wasForeground:false, sentToBack:true, no activation. With it pup carries zero z-order code. Closing.

John Lauer closed this · 2mo ago

Log in to reply.