# PDF link desktop reproduction

Run each commit from its own installed worktree using `T3CODE_DEV_SEED=0` and
`T3CODE_DESKTOP_REMOTE_DEBUGGING_PORT=<port> headless-desktop vp run dev:desktop`.
Use distinct XDG_CONFIG_HOME directories for simultaneous Electron instances.

Generate the synthetic repository with `node seed.mjs <fixture-directory>` and add it
with `node apps/server/src/bin.ts project add <fixture-directory> --title 'PDF links demo' --base-dir .t3`.
Finish onboarding without importing projects. Open the synthetic project, toggle
the right panel, choose Files, and open linked.pdf. No provider turn is needed.

The recording driver takes REPO, PORT, SIDE, ARTIFACT_ROOT, DISPLAY and XAUTHORITY
from its environment. Set DISPLAY and XAUTHORITY to those of that side's Xvfb
session. It resizes the real Electron window to 1440x900, hides the explorer,
fits the PDF width, and records native pointer input with ffmpeg. It clicks
'See p. 2', captures the resulting page/counter, returns to page 1, then clicks
'Website' and captures the desktop including the OS browser. Stills wait for
identical screenshots 500ms apart.

For an isolated external browser, use browser.sh as the Exec handler for the
http/https desktop association in the run's XDG_DATA_HOME/applications directory.
Set PDF_DEMO_OUTPUT to a scratch output directory. The browser script launches
Chrome with its own synthetic profile. This changes only the OS browser choice;
T3 still performs its real openExternal call.

Expected on base: text cursor, no anchors, page remains 1/2, no browser opens.
Expected on fix: pointer cursor, two anchors, internal click reaches page 2/2,
and external click opens https://example.com/ in Chrome.
