Developing
lnk-link-desktop is Link Desktop: an MCP server over stdio whose
calls see and work an Xvfb display, for any harness to reach as a
tool. How to use it: Link Desktop.
How it speaks X
It speaks the X protocol itself, through x11rb, with no Xlib: it
connects to /tmp/.X11-unix/X<n> with the cookie in --cookie's file
(an Xauthority file of one entry for any host, made by
lnk-link-desktop cookie), and starts Xvfb :<n> -auth <file> -nolisten tcp -nolisten local when nothing answers there, killed when the tool
ends. It makes /tmp/.X11-unix first when it isn't there: two Xvfbs
that both find none race to make it, and the one that loses can't
listen.
Screenshots and input
A screenshot is the root window's pixels (GetImage, 32 bits a
pixel) made PNG here; input is XTEST's FakeInput; a keysym no key
gives is put on a key no keysym is on (ChangeKeyboardMapping).
Build and test
From tools/, in the public workspace beside the core:
cargo build -p link-plugin-link-desktop
cargo test -p link-plugin-link-desktop --test desktoptests/desktop.rs
It starts the tool on a free display, maps a window of
its own there and checks what the window gets: the clicks at its
pixels, the characters typed, a combination held, the wheel's buttons,
and its color in a screenshot. Without Xvfb on PATH it passes, saying
so.