Wayland server libraries: wlroots, libweston, swc - Desktop Customization & Workflow

Users browsing this thread: 2 Guest(s)
mcol
Nixers
When building a wayland compositor, a decision has to be made about which library (if any) to use as a foundation on top of which to implement the more unique features specific to the compositor. This is because the compositor is also responsible for basic functionality like managing input and output devices, functionality that is generally common between compositors (or, to be more precise, between compositors with the same intended use i.e. desktop, phone, etc).

To fill this role, some libraries have appeared over the years, such as (in C):
  • wlroots: This popular library is very modular, so you can pick and choose which parts you need. The library itself covers a huge array of use cases, so it is very flexible and has lots of utility, much of which would be ignored by a given compositor. It's use seems quite intuitive (see the minimal WM example: tinywl).
  • libweston: This library's design goals appear to be similar to wlroots', but their code is IMO somewhat less clear and accessible, if viewing it with an eye to use it to create a new compositor.
  • swc: This less well-known lib is aimed primarily at tiling WMs for the desktop, and as a result is relatively small and focussed. The API for creating compositors appears simple (though I haven't had a chance to read deeply into it).

Are there any more that I have missed?

Why might you choose one over another?

If you implement a wayland compositor or plan to, which did you choose and why?

Personally I will probably try out wlroots initially due to its accessibility (it has lots of examples) to first gain an understanding of wayland in general before moving to something smaller and more focussed for my own compositor.

Please let me know if any of the info here is incorrect -- wayland is relatively new to me. Have some wacky bonus videos:
- Wayfire: wrot, fisheye, invert and zoom plugins
- Qt 5 based 3D Wayland compositor
<p><br></p>
z3bra
Grey Hair Nixers
I fell into the wayland hole as well, quite recently.

It took me days to just get a compositor started, and open a terminal inside it (I chose wio as my compositor, because I don't like tiled environments).

From now on, I want to build my own compositor (if possible), mostly to understand how the wayland protocol works internally, and differs from the X protocol.

I'll be taking notes here along the way: gopher://z3bra.org/1/notes/wayland (HTTP).

For development, I prefer starting directly at the libwayland level (raw protocol), by reading the Wayland Book, by Drew Devault. When I get the hang of the raw protocol, I'll certainly realize how boring it is, and use something like wlroots, which seems to be widely agreed upon, and is pushing a lot of new protocols to the upstream wayland repo.

But for now, there are just to many concepts I don't understant well: protocols, layers, shells, surfaces, seats, …
mcol
Nixers
wio looks awesome. I'm surprised to hear it took a while to get one started. Were there particular issues you had? I found just running some in a TTY started a session (although I didn't try that many, and most of them were wlroots based).

(03-11-2020, 12:23 PM)z3bra Wrote: I'll be taking notes here along the way: gopher://z3bra.org/1/notes/wayland (HTTP).
Nice, just read through, and will check again every now and then!

The Wayland Book is really good, super useful, and I've found it complements the small example compositors in the wlroots repository (which, of course, are specific examples of wlroots usage). I have found that wlroots is not that much "higher level" than libwayland, which I'm happy about for two reasons. First, while I learn both I don't feel like I'm missing out much by only writing wlroots stuff, and second, it means that once I've got some basic stuff going and got my head around things it looks like it would actually be totally feasible to ditch wlroots and just use libwayland. Maybe I'm wrong though.

In any case, if you haven't already read them I highly recommend the examples folder within the wlroots for seeing how a specific thing might be implement.
z3bra
Grey Hair Nixers
(08-11-2020, 11:52 AM)mcol Wrote: wio looks awesome. I'm surprised to hear it took a while to get one started. Were there particular issues you had? I found just running some in a TTY started a session (although I didn't try that many, and most of them were wlroots based).

Keep in mind that I had zero knowledge about Wayland when starting :) I didn't even know that you're supposed to start the compositor from the TTY for example. I didn't even know how to compile it, what were wayland protocols, …

Know that I understood all these concepts, it's much easier. As for wio issues, there are a few. You can't start it from the TTY directly, it hangs indefinitely. I had to start it with "cage wio" from the TTY.

When drawing a view (using the red rectangle shape), you must always grow the window from top left to bottom right, otherwise it crashes.

There is no way to move a window with the mouse as well, other than with the menu item.

(08-11-2020, 11:52 AM)mcol Wrote: In any case, if you haven't already read them I highly recommend the examples folder within the wlroots for seeing how a specific thing might be implement.


I haven't checked the example folder, but I'm using tinywl as a reference. By the way, I started my compositor and it can display a window, within which I can type things :) That's pretty much it !