My love-hate relationship with Wayland
──────────────────────────────────────────────────────────────────────
# The X windowing system, and me

It took me years to come up with the X11 setup I currently have. I had
to learn Xlib and XCB programming in the process, because I wanted an
experience so sweet an tailored to my needs that I wrote a shitload
of tools [0][1][2][3][4], just for the sake of learning how the
venerable
X.org server works internally.
I learnt a lot of stuff in the process. About the X protocol and
libraries, of course, but not only.
Because of the complexity of its interface and architecture (I'm not
saying this in a pejorative way!), I had to learn how to read the
documentation (XCB ? Documentation ?), understand its inner concepts,
organize my code better and force myself into a discipline I didn't
have before.

Building programs for my X environment also helped me think about what
I need to feel comfortable when using my computer. What makes my
workflow
more fluid, or what slows me down.
I quickly realized that tiling window managers were not for me for
example, and that I need a quick way to move windows at to opposite side
of the monitor, in a different size. That why cwm(1) quickly became my
best friend for managing windows. When I wrote glazier [3] later, I use
cwm as my model, and ended up creating a somehow stripped down version
of it, on top of XCB rather than Xlib !


Then came Wayland.

[0]: https://github.com/wmutils/core
[1]: https://github.com/wmutils/opt
[2]: git://git.z3bra.org/xmenu.git
[3]: https://z3bra.org/glazier
[4]: https://z3bra.org/man/ewmh

# Wayland, take one (2014)

I really heard about Wayland a few years ago, back when I was
discovering
Linux, and especially aesthetics of a Linux desktop. At the time, I was
trying hard to make my desktop look good to me, and was spending much
more time "improving" my workflow, rather than doing any real work.
It was pretty fun though, and helped me get into the deepest corners of
my operating system configuration, including replacing the init system
just so my "ps" output could fit on a single terminal page !

During my explorations, I stumbled upon a video showcasing a 3D Wayland
compositor [5]. The video shows a 3D where the user navigates like in
an FPS game, put application windows on the walls, and navigate between
them by "walking around" the desktop.

THAT WAS SO COOL ! So I looked into this "Wayland" thing, and discovered
that this was a competitor to the well-known X server, which I was still
experimenting with, but was slowly starting to show its limits in terms
of customisability.

I read the Wayland introductory post, and started looking into how I
could test it out, and what could be *actually* done with it. And as it
turned out… Not much.

Back in the days (around 2014), the only "viable" option was to use
weston, a compositor made to showcase Wayland, rather than do any actual
work. It featured a terminal (weston-terminal), but that's pretty much
it. You couldn't even get a web browser running, so that was FAR from
usable. I wanted to do customizations, tuning, modifications, try new
concepts… Not feel stuck in a totally meaningless desktop environment.

And so I did what every IT hobbyist does in the Unix world when a new
technology appears to "replace" and older one: join the hate bandwagon !

It was pretty easy to hate it at that time. It was advertising as the
new
challenger, yet nobody adopted it, there was nothing useful made out of
it, and the only "documentation" was the code of the single, useless,
application available: weston.
I remember trying to look at that code and was so horified that it
reinforced my hate against it. It was at that time that I decided that
X.org wasn't going anywhere, and that I could invest some more time to
learn how it works internally and start making software for it. We (dcat
and I) came up with wmutils [0], which is to this day the most "famous"
software I wrote, even though it targets a small niche.

[5]: https://youtu.be/_FjuPn7MXMs

# The Plan9 operating system

Years were passing and I stopped caring about how my desktop *look*,
to concentrate on what I could *do* with it. I started contributing to
more meaningful software, to perform data deduplication [6] for backing
up my family pictures, securely storing my passwords [7] and so on…

I also started looking into other operating systems, mostly OpenBSD
(which powers all my servers!), and Plan9.

Plan9 was a fascinating discovery at the time. The system was so
elegant,
and consistent that even OpenBSD looked messy compared to it (not even
mentioning Linux !).
Since I discovered it, I've been admirative about it, without ever
giving
it a try. Not even plan9ports ! I've however read the research paper
quite a few times, and integrated some concepts in my day-to-day
computer usage, like embracing the mouse for the correct use cases,
rather than being a "TILING WM FTW, LUV KEEB, MOUSE SUCKS LOL" kind
of guy.

[6]: git://git.2f30.org/dedup.git
[7]: https://z3bra.org/safe

# Wayland, take two (2019)

A couple years passed, and I started hearing about Wayland more and
more. There was this guy who created a simple WM for wayland, "swc",
and everyone was so enthusiastic about it!

This was the first time I heard about someone doing ACTUAL work for
Wayland. Of course I heard about GTK and Qt providing bindings for it,
but it didn't really interest me. This new window manager, however,
was the proof that real work was starting on Wayland. Then came "sway",
the compositor meant to be the i3 window manager for wayland. Later on,
a new library named "wlroots" came out of it, and started gaining
widespread usage.
I was hearing more and more people succesfully "switching to wayland
for the desktop", and I started being curious again. I looked into some
Wayland articles here and there, out of curiosity rather than from
real interest…

Then Drew Devault, the creator of the famous "wlroots" library posted
this article:

https://drewdevault.com/2019/05/01/Announcing-wio.html

It was announcing the initial release of "wio", a wayland compositor
replicating the rio(1) window manager from Plan9. THAT WAS SO COOL !
I read about rio multiple times when looking at Plan9, and tried to
replicate its usage under X multiple time, in vain. And this guy come
up with a Wayland compositor doing exactly that ?
This was the time for me to stop hating on Wayland, and actually look
into it. I started reading about it as a protocol, as a library, how it
differs from the X server, and why this is a good thing.

To be totally honest. I didn't understand. It was still to complex for
me to understand, and I started hating it again, this time for a *real*
reason: I could not understand it. From the other feedbacks I had,
many stuff were still imprecise and not working. Most people on wayland
had to resort to "Xwayland", that could let them run X software under
wayland. It felt hacky, and I decided I didn't want wayland anymore.


# Crux, OpenBSD and the lost drives

By the end of 2019, I bought myself an SSD for my workstation, deciding
that recycling old hard drives was great for the planet, but not so
for my sanity. Reinstalling your OS often because your drives fail is
good for practicing and cleaning up, but it gets boring over time and
cleaning up, but it's boring at some point.
When I got that SSD, I decided to try OpenBSD as a workstation, and
slapped it on my SSD real quick. I was happy, until I realized that I
could not mount my existing /home and /var/data partitions, because
I used LVM for partitionning my 1Tib harddrive, which stores all my
data. That's how the SSD took dust.

By the end of the year, a pandemic known as Covid-19 stroke the whole
world, and eventually resulted in a full country lockdown in march 2020.

This left me with a lot of time on my hands to eventually do stuff that
were on my TODO for a while, which includes setup up a good backup
system
for my data. That's fortunate because a few weeks later, my 1Tb drive
died spectacularly, taking with it all my data, and /home partition.

That's only a few month later that I replaced this failed drive. This
time I decided to go for a filesystem I could use on both Linux and
OpenBSD, that is, well, nothing actually.

The only common filesystems between Linux and OpenBSD are FAT32 and
ext2,
which I didn't want to use at all. I then gave up on OpenBSD, and
decided
to reinstall my current OS, Crux [8] on the SSD, when I have some time.

[8]: https://crux.nu

# Wayland, take three (2020)

Tech news come in waves. You do not hear about something for months
or years, and all of the sudden, everyone is debating it !
This is true for Wayland, up to the point I read a post about X.org
being tagged as "abandonware" [9]. This article made a lot of noise in
the wayland community and got many replies [10][11][12][13].
These discussions convinced me that Wayland was now usable, and I
decided
to look into it. Again.

And so did I…


[9]:
https://www.phoronix.com/scan.php?page=news_item&px=XServer-Abandonware
[10]: https://lobste.rs/s/vqv6nu/it_s_time_admit_it_x_org_server_is
[11]: https://ajaxnwnk.blogspot.com/2020/10/on-abandoning-x-server.html
[12]: https://lobste.rs/s/qtplaa/on_abandoning_x_server
[13]: https://arewewaylandyet.com

# Crux and the X-less ports

As of november 2020, we're going for a lockdown again, as the (in)famous
"second wave" of Covid-19 strikes again. As I get to spend more time
home,
I decided to reinstall Crux on the SSD, with a special twist this time:

The X server won't be installed at all !

This will force myself into embracing and understanding Wayland if I
want to use my computer. As time passes by, I'll certainly hit some
shortcomings of wayland, but I'm decided to actively participate in its
deployment this time !

I gave Wayland a quick try first (using X11 as the backend), to make
sure
that the software I planned on using (wio, cage, alacritty and firefox)
were usable under wayland), and started porting them on crux.
I made myself a "wayland" port tree, and started looking into what is
needed for running wayland natively on my desktop.

I'll be documenting what I find along the way, and collect thoughs on
my findings. You'll find them on my gopher hole, under /notes/wayland,
along with this "introduction".

As a conclusion, I'll say this:

Only fools never change their minds. Don't hate on a technology just
because you don't see the point, or don't understand it, because you
might embrace it later on.
Unless it's systemd. It just plain sucks.

Be happy, stay cool, and contribute ! ☮️


20201106.1728