sidorares/node-x11

Can't get WM_STATE

RossComputerGuy opened this issue · 3 comments

I can't get the WM_STATE property https://tronche.com/gui/x/xlib/ICC/.

				this.panel.app.getXClient().InternAtom(false,"WM_STATE",(err,WM_STATE) => {
					if(err) throw err;
					this.panel.app.getXClient().GetProperty(0,wID,WM_STATE,WM_STATE,0,32,(err,data) => {
						if(err) throw err;
						console.log(data);
						this.windowCount++;
					});
				});

GetProperty third parameter is property type, see

function(del, wid, name, type, longOffset, longLength) // - offest and maxLength in 4-byte units

https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GetProperty

I think you can pass 0 for AnyPropertyType , not sure what exactly type stored for WM_STATE, probably array of cardinals

WM_STATE is not only a property but also a type. x11-prop should help you with that. Something like this should work:

x11prop.get_property(X, wid, 'WM_STATE', (err, data) => {
  if (!err) {
    console.log('WM_STATE: ' + data);
  }
});

Ok, got it to work. Now I just need to figure out which windows are visible/mapped.