Open olifloof opened 2 months ago
since the ipc is it's own create, couldn't the lib be written in rust and use the ipc create rather then reading from the socket like you'd normally do
The current IPC protocol is simple enough that it's easy to at least put together an EventStream implementation in Vala, which I've been working on.
Using the official crate would be great, but my main concern would be thread safety, considering that the crate uses blocking I/O, whereas a Vala implementation can benefit from GLib concurrency
The "hard" part is the state management. While the crate has that implemented, it would have to be wrapped as a gobject, so you can bind to it. You have to check what changed and set the gobject properties accordingly. So you basically have to do the state management yourself anyway. The only thing that could be used from the crate is the reading from the socket part, which is easy to implement in vala. Using the crate therefore provides only little benefit, but introduces a lot of overhead to make it usable as a gir lib. not worth it IMO.
I was working on an implementation a few weeks ago, but stopped working on it since I'm trying other compositors. It's mostly complete but the signals could use some work: https://github.com/spazzylemons/astal/tree/niri
https://github.com/YaLTeR/niri/tree/main/niri-ipc https://github.com/YaLTeR/niri/wiki/IPC
especially
EventStream
which is available in 0.1.9 (latest release)