x11¶
The foundation every X11 client needs before it can say anything of its own: the
wire codec, the .Xauthority parser, the connection-setup exchange, the anonymous
shared-memory segment MIT-SHM attaches, and the unix-domain transport that hands the
server a descriptor over SCM_RIGHTS. Pure Go, CGO_ENABLED=0, standard library
only — no Xlib, no XCB, no cgo.
It is the one module here that is not a freedesktop specification. It is the byte
layer underneath one, and it exists because two clients needed the identical answer:
screencast asks the server to write into a shared segment, and
go-widgets/window writes into one and asks
the server to read. Two copies of a wire-protocol parser drift silently until
something fails on one back-end only.
Scope — deliberately, the bytes and nothing above them¶
There is no connection type, no event loop and no widget here. What there is:
- request/reply/error framing in both wire orders,
.Xauthorityparsing and MIT-MAGIC-COOKIE-1 selection,- the setup exchange, including the screen, visual and depth tables,
NewSegment, the shared-memory segment MIT-SHM 1.2 attaches by descriptor,DialUnix, and theSCM_RIGHTSdescriptor pass.
The one thing above the bytes is Monitors: RANDR 1.5 and XINERAMA enumeration, because
"which display is where" is not a capture question — a toolkit putting a window full
screen on a chosen panel needs the same answer.
Install¶
Platforms¶
| linux (amd64, arm64, riscv64, loong64, ppc64le, s390x) | everything, against real syscalls |
| darwin, freebsd, other unix | codec + xauth + setup + the unix transport; no shared memory |
| windows, js/wasm | codec + xauth + setup; DialUnix reports ErrNoTransport |
Both wire orders are exercised, and the big-endian path is executed on real big-endian — s390x under qemu — rather than merely compiled.
Coverage¶
100% of statements, on Linux, darwin and Windows, with no exemptions. Every line is either protocol arithmetic or a syscall behind a package variable a test can fail on purpose, so a figure below 100 means a branch nobody tested rather than a platform getting in the way.
The full API is on pkg.go.dev. Source: github.com/go-freedesktop/x11.