Is there anything similar for Wayland? Its protocol looks considerably more complex than Xorg's, and so are most resources to learn it.

It's quite ardous and unfun, but the wlroots project does most of the heavy lifting. For beginners it's probably useful to create a toy WM using wlroots[0] and dig deeper from there[1].

[0]: https://gitlab.freedesktop.org/wlroots/wlroots/-/tree/master... [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/wikis/Getti...

sway and wlroots have some of the worst error handling I've ever seen in C code. The number of null pointer bugs and assertion bugs is just mind-boggling. I don't really understand how hard it is to just gracefully handle errors. Literally no one would prefer to crash their entire desktop environment rather than have it silently skip over errors and output them to a log.

I recently used i3 again because my office computer has an NVIDIA GPU and sway doesn't support NVIDIA (yes I'm aware of the new GBM API, it's not ready yet and I don't care anymore anyway). It made me realize how much more gracefully i3 handles a lot of things, and also a few things it really doesn't (but that's more the fault of X11, not i3).

It's disappointing that the defacto library for Wayland is wlroots given those bugs.

I don't know where you heard that, but wlroots is not the defacto standard, there are several other libraries. Off the top of my head, there is libweston, mutter, mir, qtwayland, smithay, and probably some others aimed at embedded that I can't remember...

Edit: also this one somebody wrote in HTML5 and typescript https://github.com/udevbe/greenfield