Coder Social home page Coder Social logo

node-x11's Introduction

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

node-x11's People

Contributors

sidorares avatar santigimeno avatar champii avatar anko avatar rosscomputerguy avatar linuxenko avatar greenkeeper[bot] avatar drom avatar polpo avatar megadonkey avatar andrewstart avatar mat-sz avatar mgechev avatar timroes avatar andrewswerlick avatar aurium avatar bitdeli-chef avatar dominictarr avatar froquede avatar sdumetz avatar gitter-badger avatar jdomenechb avatar tiye avatar matoruru avatar vird avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.