package
A pure node.js JavaScript client implementing X Window (X11) protocol and extensions.
npm install x11GitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
1.4 MB
Includes dependencies.
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.
npm install x11Requires 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.
Core requests usage:
const x11 = require('x11');
const { Exposure, PointerMotion } = x11.eventMask;
x11.createClient((err, display) => {
if (err) {
console.log(err);
return;
}
const X = display.client;
const root = display.screen[0].root;
const wid = X.AllocID();
X.CreateWindow(
wid,
root, // new window id, parent
0,
0,
500,
examples/opengl/glxgears.js and
examples/opengl/teapot.js over indirect GLX.
More, running in your browser: the live demos.
node-x11 ships its own: x11.createServer / lib/xserver, the server the
playground runs in your
browser. Earlier DOM-based servers: