No description
Find a file
Andrey Sidorov 89fd615f8f
Merge pull request #188 from sidorares/greenkeeper/sinon-7.2.5
Update sinon to the latest version 🚀
2020-05-21 20:19:49 +10:00
autogen #182 fixed 2018-11-14 12:22:16 -08:00
examples Fixes variable declaration typo in example 2019-10-11 15:07:25 -03:00
lib Merge pull request #194 from matoruru/patch-1 2020-05-21 20:17:05 +10:00
test Begining of fixing sidorares/node-x11#182 2018-11-14 12:05:24 -08:00
.gitignore .gitignore 2020-04-24 19:35:17 +02:00
.travis.yml build: bump node versions to 12 + 14 2020-05-21 20:10:43 +10: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 Merge pull request #188 from sidorares/greenkeeper/sinon-7.2.5 2020-05-21 20:19:49 +10:00
README.md Update README.md 2019-01-15 17:24:08 +11: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 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