/node-sway

sway-ipc node.js client

Primary LanguageJavaScriptMIT LicenseMIT

node-sway

Fork of node-i3 to instead target sway.

Install

npm install git+https://github.com/Rotekoppen/node-sway

API

sway.command()

Sends the to sway, very much alike running swaymsg

Get functions

All theese functions work the same way, they fetch something and passes it to an callback.

sway.workspaces()

Gets the workspaces and passes it to the callback

sway.outputs()

Gets the outputs and passes it to the callback

sway.tree()

Gets the tree and passes it to the callback

sway.marks()

Gets the marks and passes it to the callback

sway.barConfig()

Gets the bar config and passes it to the callback

sway.version()

Gets the version and passes it to the callback

sway.modes()

Gets the available modes and passes it to the callback

sway.mode()

Gets the active mode and passes it to the callback

sway.config()

Gets the top level config file and passes it to the callback

sway.seats()

Gets the seats and passes it to the callback

sway.inputs()

Gets the inputs and passes it to the callback

Examples

Move the focus to the left, and subscribe to workspace events

var sway = require('node-sway').createClient();
sway.command('focus left');
sway.on('workspace', function(w) {
  console.log('workspace event!', w);
})

Get inputs

var sway = require('node-sway').createClient();
sway.inputs(console.log);

Get Current mode and available modes

var sway = require('node-sway').createClient();
sway.mode(console.log);
sway.modes(console.log);