User decision 2026-11-19 (mixed way). agent-desktop only presses keys in the
window in front, so the app now picks one way before any key is sent:
- behind: one key without modifiers that types or moves is posted to the
window's one shown text control (Edit, RichEdit, RichEditD2DPT, Scintilla);
the person's screen and focus stay. Windows does not tell a background
thread's focused control (win-ci VM: GetFocus is null even attached), so
only windows with exactly one text control get keys behind.
- in front for a moment: combinations, other keys and every other window;
the window that was in front is brought back after (also after a failed
press). A window already in front gets the keys there.
- never in front while game mode is on or the window in front is full screen.
- never both ways, so a key is never pressed twice.
Specs: admin.spec.md "PC control" (Keys), pc-features.md, pc_control.spec.md.
Tests: six new fake-desktop tests in pc.rs; tests/pc_keys_windows.rs on a real
desktop (win-ci VM: letters behind Notepad with Character Map kept in front,
ctrl+a in front and back, the classic Calculator in front and back).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>