sidorares / node-x11

X11 node.js network protocol client
MIT License
518 stars 72 forks source link

Add support for abstract namespace sockets #171

Open EchoAbstract opened 6 years ago

EchoAbstract commented 6 years ago

By default xorg opens '/tmp/.X11-unix/X«display number»' as both an abstract namespace and a filesystem based domain socket. If you're running in a snap container you're able to access the abstract namespace socket but not the filesystem socket. (Abstract namespace domain sockets show up as @''/tmp/.X11-unix/X«display number»', but effectively just have a null byte as the first character in the sun_path field, see http://man7.org/linux/man-pages/man7/unix.7.html).

It'd be nice to have node-x11 support the abstract namespace versions of the x11 socket.

There's an NPM module, abstract-socket, that might be useful.

sidorares commented 6 years ago

should be easy, I already use it in dbus client - https://github.com/sidorares/dbus-native/blob/7ddc7ebd0b6b988177733a8ac4b2f0aeff70cc73/index.js#L43-L46

Since you already have something to test against - maybe you could try to add abstract-socket support? Domain socket connection is established here - https://github.com/sidorares/node-x11/blob/97a582be5c135c884342035e9967b2480d9e93ea/lib/xcore.js#L642-L644