Pure JavaScript, zero dependencies
No native code, no node-gyp, no runtime dependencies. The library speaks the X11 wire protocol directly over a unix socket or TCP.
Full core protocol + extensions
All 120 core requests and 34 events, plus RENDER, RANDR, XFIXES, Composite, Damage, SHAPE, XTEST, XKB, XInput, MIT-SHM and many more.
GLX / OpenGL
Full GLX 1.4 support with vendor extensions: create GL contexts and render OpenGL over the X protocol, straight from Node.js.
Runs in the browser
Pluggable transports let the client run against any duplex stream — in-browser live demos are coming to the Playground.
Talk to the X server directly
Install with npm install x11, connect with a single call, and every core request is a method on the client — windows, graphics contexts, drawing, events.
const x11 = require('x11');
x11.createClient((err, display) => {
const X = display.client;
const wid = X.AllocID();
X.CreateWindow(wid, display.screen[0].root, 0, 0, 500, 500, 0, 0, 0, 0, {
eventMask: x11.eventMask.Exposure,
});
X.MapWindow(wid);
const gc = X.AllocID();
X.CreateGC(gc, wid, { foreground: display.screen[0].black_pixel });
X.on('event', ev => {
if (ev.name === 'Expose')
X.PolyText8(wid, gc, 50, 50, ['Hello, Node.JS!']);
});
});