Skip to content

fix(desktop): strip Wayland env vars so launched apps stay on the lab display#16

Merged
ElbertePlinio merged 2 commits into
mainfrom
fix/lab-display-wayland-leak
Jul 10, 2026
Merged

fix(desktop): strip Wayland env vars so launched apps stay on the lab display#16
ElbertePlinio merged 2 commits into
mainfrom
fix/lab-display-wayland-leak

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

What changed

desktop_launch overrode DISPLAY but inherited WAYLAND_DISPLAY/WAYLAND_SOCKET from the server process. Toolkits that prefer Wayland (GTK, Qt, Electron, Flutter) therefore opened "lab" apps on the user's real desktop instead of the isolated Xvfb display — and driving them there moved the real cursor. launchApp now unsets both variables in the launched app's environment, so apps always render inside the lab display.

docs/releases/UNRELEASED.md updated (user-facing change).

Tested

  • New regression test: launched app sees DISPLAY=<lab display> and no WAYLAND_DISPLAY, even when the caller's env sets one.
  • Full suite green: 562 passed / 1 skipped (49 files), including live Xvfb + xdotool + xterm integration tests.
  • bun run typecheck clean.

Not tested

  • Manual end-to-end with a real Wayland-preferring GUI app (e.g. a GTK Flutter build) on a Wayland desktop.

Risks

  • An app that only supports Wayland will now fail to start in a lab session; previously it "worked" by silently escaping to the real desktop, so this is the correct failure mode.

Refs #15 (live-viewing follow-up: nested-display sessions).

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7b9ae16b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/desktop-linux/src/apps.ts Outdated
// Toolkits (GTK, Qt, Electron, Flutter) prefer Wayland when these are
// set, which would open the app on the user's real desktop instead of
// the isolated lab display. undefined values are dropped at spawn.
WAYLAND_DISPLAY: undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set an invalid Wayland display instead of unsetting it

WAYLAND_DISPLAY: undefined still leaves Wayland clients free to call wl_display_connect(NULL), which libwayland documents as falling back to wayland-0 under XDG_RUNTIME_DIR when WAYLAND_DISPLAY is unset (https://man.archlinux.org/man/extra/wayland-docs/wl_display.3.en#wl_display_connect). On a normal Wayland login using that default socket, GTK apps that try Wayland first can still open on the user's real compositor instead of the Xvfb DISPLAY; use a deliberately invalid Wayland display or force the X11 backend rather than deleting the variable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid — fixed. WAYLAND_DISPLAY is now set to a deliberately invalid socket name (picklab-no-wayland) instead of being unset, forcing the X11 fallback even when the compositor listens on the default wayland-0.

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 36f158002d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… display

Toolkits (GTK, Qt, Electron, Flutter) prefer Wayland when WAYLAND_DISPLAY
is set, so apps launched via desktop_launch opened on the user's real
desktop instead of the isolated Xvfb display - and driving them moved the
real cursor. Unset WAYLAND_DISPLAY and WAYLAND_SOCKET in the launch env so
apps always render inside the lab display, which has its own pointer.
…nsetting it

With the variable unset, wl_display_connect(NULL) falls back to the
default wayland-0 socket, so Wayland-first toolkits could still reach the
real compositor. An invalid socket name forces the X11 fallback.
@ElbertePlinio ElbertePlinio force-pushed the fix/lab-display-wayland-leak branch from 36f1580 to bdc99a7 Compare July 10, 2026 01:34
@ElbertePlinio ElbertePlinio merged commit 3b076c0 into main Jul 10, 2026
1 check passed
@ElbertePlinio ElbertePlinio deleted the fix/lab-display-wayland-leak branch July 10, 2026 01:39
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