i3.command restart
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.
You'll need to wait until it's restarted. This works for me:
var i3 = require('../index.js').createClient();
i3.command('restart');
setTimeout(function() {
var i4 = require('../index.js').createClient();
i3.command('focus left', function() { console.log(arguments) });
}, 100);
Not sure if there is better way apart from checking for errors and retrying
What needs to be fixed is when there is error and commands in the queue - broadcast error to them. Right now you can attach error handler to client itself, but command callback is not called with error response
That seems to do the trick! It occasionally seems to crash though. Not sure yet why it does that. But thanks. Also, your example above re-inits as i4, then calls i3, typo perhaps?
typo, I intended to call method on new instance "i4". Is crash the same? (timeout too small?)
I tried increasing the timeout to 200ms - seems to still crash occasionally as I rapidly resize my X display (see below for what I'm trying to achieve).
If it helps, I'm using i3 as a WM under Xephyr. As I resize my main Xephyr window, I am 'restarting' i3 so that my applications resize themselves correctly. I have a node-webkit app running inside i3, through which, I'm using the i3ipc to control i3. The errors I see are as follows (can't copy paste for some reason!) - so typed verbatim:
Uncaught node.js Error
Error: connect ENOENT
at exports._errnoException (util.js:742:11)
at Object.afterConnect [as oncomplete] (net.js:995:19)
Not quite understand why you need to restart i3. It seems that it tracks randr events correctly (I'm using it inside virtualbox and also resize window from time to time)
Hmm...wonder if virtualbox (Xorg Xserver derivative?) behaves differently from Xephyr? Without a restart, as I expand my 'container app' (aka Xephyr), I see empty space around my node-webkit application, until I restart i3. But you are right, as I resize Xephyr, i3 does log a message like: "root geometry size....", as the X server size is changing. But my nw app (or say xterm or other X application) does not resize itself till I restart i3.
Check that you have randr enabled in Xephyr ( post your xdpyinfo | head -n 50 )
my virtualbox server is running mint linux, so it's full Xorg (just video device happens to be virtulized)
Here you go. I do see RANDR.
name of display: :1 version number: 11.0 vendor string: Fedora Project vendor release number: 11404000 maximum request size: 16777212 bytes motion buffer size: 256 bitmap unit, bit order, padding: 32, LSBFirst, 32 image byte order: LSBFirst number of supported pixmap formats: 7 supported pixmap formats: depth 1, bits_per_pixel 1, scanline_pad 32 depth 4, bits_per_pixel 4, scanline_pad 32 depth 8, bits_per_pixel 8, scanline_pad 32 depth 15, bits_per_pixel 16, scanline_pad 32 depth 16, bits_per_pixel 16, scanline_pad 32 depth 24, bits_per_pixel 32, scanline_pad 32 depth 32, bits_per_pixel 32, scanline_pad 32 keycode range: minimum 8, maximum 255 focus: window 0xc00022, revert to PointerRoot number of extensions: 21 BIG-REQUESTS Composite DAMAGE DOUBLE-BUFFER DPMS Generic Event Extension MIT-SCREEN-SAVER MIT-SHM RANDR RECORD RENDER SHAPE SYNC X-Resource XC-MISC XFIXES XINERAMA XInputExtension XKEYBOARD XTEST XVideo default screen number: 0 number of screens: 1
screen #0: dimensions: 1091x822 pixels (347x260 millimeters) resolution: 80x80 dots per inch depths (7): 1, 4, 8, 15, 16, 24, 32 root window id: 0x53 depth of root window: 24 planes