YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
2.82k stars 79 forks source link

Draft: Event stream IPC #453

Open YaLTeR opened 2 weeks ago

YaLTeR commented 2 weeks ago

Some basic scaffolding for an event stream IPC.

  1. Changed the client to read only a single line worth of response.

    This mirrors how the server works, and will be necessary to tell apart further messages. Events will arrive at one per line.

  2. Added Request::EventStream that replies with Response::Handled and then proceeds to write one Event per line as they occur.
  3. Events will be designed in such a way that the initial burst will synchronize the current state to the client, then subsequent events will modify that state in a consistent way. E.g. the initial burst of events will create all current outputs and workspaces.
  4. Compositor-side, event stream clients have a buffer of events for sending. If this buffer runs too large (the client hanged and isn't reading), this client will be dropped. This is kinda similar to what Wayland itself does.

The events are all subject to change until this PR is merged. Currently only the WindowFocused is actually implemented, and I'm planning to change its type too.