Yikes. This is a great illustration of why I've steered clear of Wayland, when even with wlroots you end up with that much code to do that little.
TinyWM for X is 50 lines.
> Sway also has a "reload" feature that preserves all open applications.
As far as I understand, sway's reload just reloads the configuration. If Sway crashes, or you kill Sway's process, there's nothing left holding the sockets to the clients open, or managing the display - that's equivalent to killing the X server, not the wm.
With an X wm, as long as your x session isn't set up to quit when the wm quits, you can brutally shut down the wm, or it can crash, and the windows stay open, and you can restart your wm - or start another wm entirely - without losing any windows.
Of course, that's a new feature they're working on, only helps QT apps, and requires the toolkit to track state (and by the same virtue, looks like it would have worked fine with X11 if they wanted to). So this is more of an interesting related tidbit rather than a disagreement.
That's an interesting approach. It'd be easy enough to do for my own X apps as I'd mostly need to flush some caches and recreate windows and pixmaps. It'd generally be terminals that are most painful to use, and the terminal would be nearly trivial since they keep an buffer of the text anyway and so can trivially recreate the view once they succeed in reopening the window (the font rendering caches glyphs, and caches graphics contexts; just flushing those caches client side would make the terminal recreate them as needed)
Whether X or Wayland it would certainly make experimenting less painful. Browsers doesn't matter that much given they're reasonably decent at restoring.
(Another option there is xpra - "screen for X")
Fewer and fewer reasons not to start writing an X server ;)
> It'd generally be terminals that are most painful to use, and the terminal would be nearly trivial since they keep an buffer of the text anyway and so can trivially recreate the view once they succeed in reopening the window
The cheap version of this is just using tmux/screen, but yeah honestly I suspect a lot of programs are easy to make recreate their GUI state if you care to bother, it's just that not everyone does (or should; it's a trade off and display servers aren't usually that crashy).
> I can restart my wm without exiting my X session
Sway also has a "reload" feature that preserves all open applications.