Skip to content

feat(stealth): present a real screen and scrollbars in headless sessions - #6

Merged
b1zya merged 3 commits into
mainfrom
feat-headless-screen
Sep 25, 2026
Merged

b1zya merged 3 commits into
mainfrom
feat-headless-screen

Conversation

@b1zya

@b1zya b1zya commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Headless Chrome reports an 800x600 screen with no taskbar on any machine, and Playwright hides its scrollbars (0 px, where Chrome on Windows draws 15). Both are one-line checks for a detector.

What changes

  • With a display, a headless session presents the host's primary monitor — size, work area (taskbar, menu bar, panel) and scale — read without opening a window, passed to Chrome as --screen-info, with the window filling the work area. A profile now reports the same screen headed and headless. Probes: Windows Forms through hidden PowerShell (~0.3 s), NSScreen through JXA on macOS (AppKit in-process, no privacy permission), xrandr + _NET_WORKAREA on Linux/X11.
  • Without a display (a server, an SSH or service session), a common desktop of the platform stands in — Windows 1920x1080 with a 48 px taskbar, macOS 1440x900 at 2x under the menu bar, Linux 1920x1080 with a top bar — and the launch carries a headless-screen note, as the repo's rule for emulation defaults asks.
  • --window-size, --screen-info through --extra-arg, --device and --mobile keep their own values; headed is untouched.
  • --hide-scrollbars joins ignoreDefaultArgs in headless (the user's own list is kept; ignoreDefaultArgs: true stays true).

Measured (Chrome 153, Windows 11, 2560x1440 at 100%)

clean Chrome, no automation headless before headless now
screen 2560x1440 800x600 2560x1440
available screen 2560x1392 800x600 2560x1392
outer window 2560x1392 780x580 2560x1392
scrollbar 15 0 15
platformVersion 20.0.0 10.0 10.0 (residual)
outer-inner width / height 0 / 87 16 / 95 16 / 95 (residual)

No display (simulated with SSH_CONNECTION): 1920x1080, available 1920x1032, outer 1920x1032, with the note. --screen-info sizes are physical pixels (checked: 2560x1440 devicePixelRatio=1.5 gives 1707x960 in the page), so a scaled screen is written back multiplied.

platformVersion comes from Playwright deriving client-hint metadata from the overridden user agent and has no API to pass the real value; the frame metrics are headless window emulation. Both are in the residual list, along with the minimized-window contradiction found in the same investigation (docs only, no code: a warning would be the only lever).

Verification

npm run check clean; 120 unit, 19 integration, 7 stealth passed; selftest 37 passed, 0 failed. The stealth test now asserts that the page screen equals the one the launch announced, is not 800x600, and has scrollbars (not on macOS, which draws overlay ones). The macOS and Linux probes run for real only in CI here.

🤖 Generated with Claude Code

Headless Chrome reports an 800x600 screen with no taskbar and a window inside it on
any machine, and Playwright hides its scrollbars (0 px where Chrome on Windows draws
15). Both are one-line checks.

With a display, the screen is now the host's primary monitor -- size, work area and
scale, read without a window (Windows Forms, NSScreen, xrandr/_NET_WORKAREA) -- passed
as --screen-info with a window over the work area, so a profile reports the same
screen headed and headless. Without one (a server, an SSH or service session) a common
desktop of the platform stands in and the launch says so (headless-screen note).
--window-size, --screen-info through --extra-arg, --device and --mobile keep their
own values. --hide-scrollbars joins ignoreDefaultArgs in headless.

Measured on Chrome 153, Windows 11, 2560x1440: screen, available screen, outer window
and scrollbar width now equal a clean, non-automated Chrome; platformVersion and the
window frame metrics stay headless and are listed as residuals.
@b1zya
b1zya merged commit 544960b into main Sep 25, 2026
5 checks passed
@b1zya
b1zya deleted the feat-headless-screen branch September 25, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant