SUPERCILEX / clipboard-history

Ringboard—the clipboard manager for Linux
Apache License 2.0
143 stars 5 forks source link

Add broadcast API aka watch support #12

Open SUPERCILEX opened 1 month ago

SUPERCILEX commented 1 month ago

Add a way for clients to be notified when anything changes. Ideally the API tells you what changed but probably also needs an escape hatch to say "eh, dunno reload everything" for garbage collection for example. Previous notes: https://github.com/SUPERCILEX/clipboard-history/issues/3#:~:text=Extra%20commands%20for%20the%20client%3A

SUPERCILEX commented 1 month ago

For the UI to be efficient, I think we need to subscribe to server broadcasts while visible, drop the connection while in the background, and statx every bucket and ring with a full reload when back in the foreground. Since the server doesn't store a log of operations, there's no way to efficiently generate a diff between two random points in time. Also when reconnecting to the server we need to subscribe to changes before doing a full refresh to avoid the case where the server GCs as we refresh.