Skip to content

fix: respect existing DISPLAY instead of always spawning Xvfb#4893

Open
chdlc wants to merge 1 commit into
jo-inc:masterfrom
chdlc:fix/use-existing-display
Open

fix: respect existing DISPLAY instead of always spawning Xvfb#4893
chdlc wants to merge 1 commit into
jo-inc:masterfrom
chdlc:fix/use-existing-display

Conversation

@chdlc

@chdlc chdlc commented May 31, 2026

Copy link
Copy Markdown

Problem

On Linux the server always spawns a new Xvfb virtual display, even when DISPLAY is already set (WSLg, X11 forwarding, desktop environments). This forces the browser onto the invisible virtual display instead of the user's real screen.

Fix

Check process.env.DISPLAY before creating Xvfb. If set, reuse it directly. If not set, fall back to Xvfb as before.

No new env vars, no config changes. Fully backward compatible.

Testing

  • Unit tests: 676/676 passing
  • With DISPLAY set (WSLg): browser launches on real screen, logs using existing display
  • Without DISPLAY (Docker, CI): Xvfb created as before, no behavior change

On Linux the server always starts a fresh Xvfb even when DISPLAY is
already set (WSLg, X11 forwarding, etc). This puts the browser on
the virtual display instead of the user real screen.

Now we check DISPLAY first — if it is there, use it. If not, Xvfb
as before.

Signed-off-by: Christian de la Cruz <chrisdlc119@outlook.com>
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