Skip to content

MCP: headless Xvfb on WSLg, and arrow/punctuation key names - #6

Open
frachel wants to merge 1 commit into
mozzwald:ai-mcpfrom
frachel:mcp-wsl-xvfb-and-keys
Open

frachel wants to merge 1 commit into
mozzwald:ai-mcpfrom
frachel:mcp-wsl-xvfb-and-keys

Conversation

@frachel

@frachel frachel commented Oct 11, 2026

Copy link
Copy Markdown

Two small fixes to mcp-server/index.js, found while driving a FujiNet game client headlessly under WSL2.

Headless start fails on WSLg. WSLg mounts /tmp/.X11-unix read-only. Xvfb prints failed to create listener for unix, then carries on listening on its abstract socket, which Xlib still reaches. But waitForXvfb only watches for /tmp/.X11-unix/X<n>, so atari_start and fujinet_boot always fail with "Xvfb did not become ready before timeout". Xvfb is now started with -displayfd 3, and readiness is either the display number arriving on that fd or the socket file. Nothing changes where the socket file does appear.

No arrow keys. KEY_CODES only had letters, digits, space/return/esc/tab/backspace, so atari_press_key rejected up and friends. I've added up/down/left/right, help, atari, caps, delete and the common punctuation, all taken from src/akey.h. The shifted symbols carry AKEY_SHFT in the code itself, so the shift handling is unchanged.

Tested with fujinet_boot of an ATR, then name entry, an arrow-key menu and START, through to the client talking to its server over N:. That ran headless on Ubuntu under WSL2 with FujiNet-PC 1.6.0.

One more thing I noticed but didn't change: atari_type_text at its default 2 frames per key dropped the first character in my client. 6 frames per key was reliable. A small gap between keys may be a better default.

🤖 Generated with Claude Code

…names

On WSLg /tmp/.X11-unix is a read-only mount, so Xvfb listens only on its
abstract socket and the X<n> socket file the readiness check waits for
never appears. Watch -displayfd as well.

KEY_CODES had no arrows or punctuation; add them from src/akey.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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