Pure-JavaScript X11 protocol client for Node.js — no native code, no runtime
dependencies. It implements all 120 core protocol requests and 34 core events,
and the Apple-WM, BIG-REQUESTS, Composite, DAMAGE, DOUBLE-BUFFER, DPMS, DRI3,
Generic Event, GLX, MIT-SCREEN-SAVER, MIT-SHM, Present, RANDR, RECORD, RENDER,
SHAPE, SYNC, X-Resource, XC-MISC, XFIXES, XINERAMA, XInputExtension, XKEYBOARD,
XTEST and XVideo extensions — including the modern direct-rendering path (GPU
frames as dma-buf pixmaps via DRI3 + Present, see docs/ext/dri3.md).
The API reference is in docs/.
Documentation & live demos: https://sidorares.github.io/node-x11/ — the
playground runs ordinary
node-x11 code in your browser against a pure-JavaScript X server (lib/xserver)
that ships with this package, including OpenGL via GLX translated to WebGL
(browser/glx/).
The client also runs in browsers: DISPLAY strings accept a pluggable
protocol prefix (x11.registerDisplayProtocol(name, connect) +
myproto/host:0), and createClient({ stream }) accepts any duplex stream.
See the custom transports guide.
It runs under Bun too, including the parts that pass file
descriptors over the connection (MIT-SHM segments, DRI3 buffers) — and there,
uniquely, descriptors can also be received: see
Running under Bun.
Install
npm install x11
Requires Node.js 18 or later, or Bun.
Windows: run an X server such as VcXsrv,
Xming or Cygwin/X.
On Windows the client always connects over TCP (port 6000 + display number, to
display :0 on localhost when DISPLAY is unset), so the server has to
accept TCP connections. Inside WSL, node-x11 is an ordinary Linux client.