fix(browser): the bot opens its pages in windows of their own behind, so it never takes the focus

On the shared screen a tab brought to the front makes Chrome bring its window forward and take the
keyboard focus from the game or program the user is in (seen on the game PC). The botBrowser tool
now opens each person's page in a window of its own, behind and at the place and size of the bot
browser's window (Target.createTarget with newWindow and background), and closes it again if the
connection to it fails. While the browser runs on the virtual monitor, the app looks for new Chrome
windows every 200 ms and settles each like the first (tool window, fitted to the work area, without
activating it), the newest in front of the older ones, so the shared screen shows the page the bot
opened last.

Checked on the game PC: the bot's window loading a public page comes in front of the first, both
out of the taskbar and Alt+Tab, the focus staying in Discord also with the user idle for hours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-15 16:15:36 +09:00
parent cb2dda25b6
commit bd7b69d4f4
8 changed files with 221 additions and 55 deletions

View File

@@ -444,7 +444,11 @@ the browser runs headless with a note.
area (Windows may give the monitor a taskbar of its own) and goes behind all other windows, all
without activating it. It keeps drawing when covered (`--disable-backgrounding-occluded-windows`,
`--disable-renderer-backgrounding`, `--disable-background-timer-throttling`). The window holds
the first tab, which the bot never closes; the bot's tabs open in it, the newest in front.
the first page, which the bot never closes. The bot's pages open in windows of their own
(bot_browser.spec.md), behind and at this window's place, because a tab brought to the front
takes the keyboard focus. While the browser runs, the app looks for new windows every 200 ms
and settles each the same way, the newest in front of the older ones, so the shared screen shows
the page the bot opened last.
- If the monitor or the window cannot be made, the browser runs headless and the dashboard's
`browser` note says why ("가상 모니터 없이 실행: ...").
@@ -811,8 +815,9 @@ started elevated, the same program is the elevated half; `tests/bot_browser.rs`
driver installed through the elevated start (Windows' SignPath question answered once) with the
settings folder's permissions, a declined install leaving no device, package, registry key or
settings folder and the next install giving one working device, the monitor off after install, on at the rightmost monitor's corner
while the bot browser runs and off after, one Chrome window there filling the work area and holding
the bot's tab, the focus staying in the program the user types into, no taskbar button, no Chrome
while the bot browser runs and off after, one Chrome window there filling the work area, then the bot's own
window (opened as the tool opens it, loading a public page) in front of it, the focus staying in the program the user types into
also with the user idle past Windows' focus lock, no taskbar or Alt+Tab entry for either, no Chrome
left after the stop, and the uninstall leaving no device, driver package, registry key or settings
folder. Game detection (`tests/game_watch.rs`): a program started from a Steam game folder (also under
a path with non-ASCII letters) or from a Battle.net game's install folder (a test uninstall entry)
@@ -848,4 +853,4 @@ after OK, and starts normally once released; `/S /RUN` (fresh, and over a runnin
and the finish page's "Jarvis 실행" start the app's window; a silent install while the uninstaller's
window is open, and a silent uninstall while the installer's is, stop with code 5 and change
nothing. On Linux the same window test runs on an X display (one window at the given place and
size, the bot's tab in it).
size, the bot's own window at the same place).