How do I write a dock app which works on Wayland?

I’ve been using gkrellm for years as a system monitor which lives on the side of my screen. Unfortunately it’s gtk2, which means it only works on Wayland via X11 emulation, and the docking functionality doesn’t work there. I filed a bug on kwin about this and it got closed as WONTFIX stating that kwin won’t support the X11 struts APIs. https://bugs.kde.org/show_bug.cgi?id=515625

As it’s unlikely that gkrellm will be changed to work with Wayland I thought that it’d be an interesting project to write my own system monitor, but very quickly got into a maze of different APIs and missing documentation (my favourite is this page in the Wayland Book about desktop shell components: Desktop shell components - The Wayland Protocol ).

I think that the layer-shell API is what I’m looking for, but it seems that this doesn’t work on Gnome? I use KDE, and it does work there, but writing software that doesn’t work everywhere seems rude.

What alternatives are there? I know I can write a Plasma widget, but again, that will only work on KDE. Are there, e.g., standard protocols for embedding applications inside the DE’s docks that are reasonably DE-agnostic?

I guess you mean wlr-layer-shell? That does sounds at least worth a try and seems widely supported on the compositor side.

They probably have some other protocol for their communication between GNOME Shell and Mutter.
However, they probably expect people to implement such a thing as a Shell Extension.

wlr-layer-shell seems to be supported on every desktop compositor other than Mutter.

Are there any libraries which abstract over the details of which compositor the user’s using, allowing me to write a DE-independent application? (This was so much easier on X11!)

I guess that depends on whether someone else has had the same or a similar need.

In general it is much easier to use additional/extension protocols with Wayland since there is much more extensive tooling.

The tooling for X11/XCB only generates C-APIs while there is Qt specific tooling for Wayland that will generate C++/Qt based classes.

Unfortunately I don’t know where in Qt or KDE the usage of the wlr-layer-shell protocol is, as that would probably make a good example.

Edit: Yakuake might be an example to look at, it is also “docked” to a screen edge