node-i3
i3-ipc client for node.js Helps you to automate i3 window manager
Install
npm install i3
API
var i3 = require('i3').createClient();
i3.command('focus left');
i3.on('workspace', function(w) {
console.log('workspace event!', w);
})
i3-ipc node.js client
License: MIT License
i3-ipc client for node.js Helps you to automate i3 window manager
npm install i3
var i3 = require('i3').createClient();
i3.command('focus left');
i3.on('workspace', function(w) {
console.log('workspace event!', w);
})
I'm trying to issue a i3.command('restart') and that basically kills my i3ipc client object. I then try to re-create the i3ipc client object. That doesn't seem to work? I get this error:
"Uncaught Error: connect ENOENT", source: events.js (82)
Any thoughts or suggestions on how to make it happen? Thanks for your package and help so far.
i3 has nothing to do with ion. Please remove the wrong wording.
I registered for window events
i3.on('window', function() {
console.log(arguments);
});
and the success response for a subscription is an object {"success":true}
but line 145 seems to be expecting an array? Can you please take a look?
example:
var i3 = require('i3').createClient();
i3.tree((err,tree) => {
console.log(tree);
});
stdout:
buffer.js:761
return this.utf8Write(string, offset, length);
^
RangeError: Offset is out of bounds
at RangeError (native)
at Buffer.write (buffer.js:761:21)
at encodeCommand (/home/florian/node_modules/i3/lib/ipc.js:54:7)
at I3IpcClient.message (/home/florian/node_modules/i3/lib/ipc.js:116:14)
at I3IpcClient.tree (/home/florian/node_modules/i3/index.js:25:8)
at Object.<anonymous> (/home/florian/test.js:3:4)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
node version 6.4.0
node-i3 version 0.2.0
i3 version 4.12
work perfecly with node 6.3.1
Sway is a wayland equivalent to i3.
I did it myself by adding
I3IpcClient.prototype.inputs = function(cb) {
this.message(100, null, cb);
};
I3IpcClient.prototype.seats = function(cb) {
this.message(101, null, cb);
};
to index.js
and changing var GET_SOCKET_PATH_CMD = 'i3 --get-socketpath';
to var GET_SOCKET_PATH_CMD = 'sway --get-socketpath';
This line
handler(null, payload[0])
does not work if the response to i3.tree
or i3.workspaces
returns an object or array with multiple items. A simplistic fix by changing the above to just say payload
, works with examples/tree.js but doesn't work reliably in other cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.