No description
Find a file
2018-11-14 11:44:12 -08:00
autogen initial implementation of xcb xml -> js generation 2012-11-27 11:42:57 +11:00
examples png rendering example 2016-11-30 18:37:13 +02:00
lib Fixed the unpack stream so arrays can work 2018-11-14 11:44:12 -08:00
test Fix 'root' deprecation warning 2018-01-23 22:35:49 +01:00
.travis.yml Travis: stop testing on Node 0.10 + 0.12 2018-01-23 22:36:27 +01:00
Changelog.md start changelog 2015-02-19 20:45:06 +11:00
LICENSE year bump 2012-06-13 15:14:12 +10:00
package.json chore(package): update sinon to version 6.0.0 2018-06-11 05:58:46 +00:00
README.md make text example work when default bg color is black 2018-07-09 14:01:14 +10:00
roadmap.txt tick what's done 2012-11-27 11:38:33 +11:00
test-runner.js Check for errors directly instead of with isError 2014-11-03 16:43:37 +01:00

node-x11

X11 protocol client for Node.js: implements the core X11 protocol, as well as Xrender, Damage, Composite, Big-Requests, Dpms, Screensaver, XFixes, Shape, XTest, XC-Misc, GLX, and Apple-WM extensions.

Gitter Build Status

Install

npm install x11

Windows users:

  1. install XMing or Cygwin/X
  2. get node-x11 copy (using git or from Github)

Example

Core requests usage:

/*
var nomnoml = require('nomnoml');
var src = '[nomnoml] is -> [awesome]';
console.log(nomnoml.renderSvg(src));
*/

var x11 = require('x11');

var Exposure = x11.eventMask.Exposure;
var PointerMotion = x11.eventMask.PointerMotion;

x11.createClient(function(err, display) {
  if (!err) {
    var X = display.client;
    var root = display.screen[0].root;
    var wid = X.AllocID();
    X.CreateWindow(
      wid,
      root, // new window id, parent
      0,
      0,
      500,
      500, // x, y, w, h
      0,
      0,
      0,
      0, // border, depth, class, visual
      { eventMask: Exposure | PointerMotion } // other parameters
    );
    X.MapWindow(wid);
    var gc = X.AllocID();
    X.CreateGC(gc, wid);
    var white = display.screen[0].white_pixel;
    var black = display.screen[0].black_pixel;
    cidBlack = X.AllocID();
    cidWhite = X.AllocID();
    X.CreateGC(cidBlack, wid, { foreground: black, background: white });
    X.CreateGC(cidWhite, wid, { foreground: white, background: black });
    X.on('event', function(ev) {
      if (ev.type == 12) {
        X.PolyFillRectangle(wid, cidWhite, [0, 0, 500, 500]);
        X.PolyText8(wid, cidBlack, 50, 50, ['Hello, Node.JS!']);
      }
    });
    X.on('error', function(e) {
      console.log(e);
    });
  } else {
    console.log(err);
  }
});

Screenshots

tetris game XRENDER gradients OpenGL glxgears OpenGL teapot

In use

  • ntk - higher level toolkit on top of X11
  • node-remote - media center controller
  • tiles - tiling window manager
  • vnc - vnc client.
  • node-ewmh - set of EWMH helpers.
  • OdieWM - window manager
  • Dbusmenu - unity global menu client.
  • AirWM - tiling window manager
  • npdf - pdf viewer
  • tinywm The famous TinyWM written in node.js
  • basedwm Infinite-desktop panning X window manager in LiveScript

X11 resources/documentation:

Other implementations

Server side (protocol + functionality) implementations for js + DOM

would be really great to make completely web based playground page, connecting node-x11 api to DOM based implementation