TL;DR: Smithay is a project to build a tooling ecosystem to do wayland apps in rust, both client and server side. This post describes in more details the aim of the project, its status, and how you can help if you want.

Some of you probably read my previous blog posts regarding the wayland-client and wayland-server crates, and the pain I endured trying to make a rusty API on top of the wayland C libraries. Well, the thing has grown since, a few people have joined, and I'm happy to announce now the Smithay project!

Why and How?

Smithay is now a github organisation, with the aim to regroup a few repositories and rust crates towards the goal of creating a common set of tools to ease development of Wayland apps in Rust. This goal is pursued with these conditions in mind:

  • Safety: We are doing rust, so it's the least to expect. The libraries should be memory-safe to use, thread-safe and thread-friendly as much as possible.
  • Compatibility: The goal is to remain compatible with the rest of the Wayland ecosystem. This means being compatible with all client/servers, but also other libraries. As such, the crates from Smithay can work with wayland objects coming from other libraries, and wayland objects from wayland-client or wayland-server can be used in C libraries.
  • Modularity: Smithay is not meant to be a framework, to which you provide a few callbacks and does the rest for you in a rigid way. We aim for a "use what you want" approach, providing several independant modules, which can do a lot of work for you if you use them, but that you can replace by your own implementation at any level if you need to.

Smithay aims to abstract away all the generic logic that client and servers are required to implement due to the minimalistic aspect of the wayland protocol, but doing so while making as few hypothesis as possible regarding what your program will look like or what it will do.

What's current status?

The Smithay organization currently hosts 4 repositories:

wayland-rs

Github link

This repository is the fundamental building block of the project. It hosts 5 crates, that together implement the binding logic to wayland:

  • wayland-sys hosts the bindings to the C libraries provided by the wayland project
  • wayland-scanner is a tool to parse XML protocol specifications and generate Rust code according to it
  • wayland-client is the entry point for projects willing to create client wayland apps
  • wayland-server is the equivalent for server apps (also known as compositors in the wayland jargon)
  • wayland-protocols provides pre-generated code for various common protocol extensions to wayland

In most cases, you'll probably only need to use wayland-client or wayland-server, and wayland-protocols. You will only need the two other crates, wayland-sys and wayland-scanner, if you need to use a protocol extension that is not provided by wayland-protocols.

wayland-kbd

Github link

This is the first module you can use to ease your development. It is a module for client apps, and it simply handles for you the keymap translation from raw keyboard events to utf8 strings, using libxkbcommon.

wayland-window

Github link

This is a second module for client apps. This one draws basic decoration around your window (many wayland servers will not draw them for you, such as Gnome's mutter), allowing it to be dragged and resized.

The decorations are cuurently ugly and lacks other functionnality, such as "minimize" and "close" buttons, or displaying the app's name in the titlebar. There is still some work to be done!

smithay

Github link

The biggest repository, and the most WIP. This is the server toolset, it aims to provide several abstractions and modules used to create wayland server, mostly divided in two categories:

  • "frontend" modules to handle interactions with the clients
  • "backend" modules to handle interactions with the OS (such as retrieving device events for inputs, and drawing to the framebuffer)

For now smithay only provide a few client-handling modules, and a single backend: being started as a Winit app (so inside an other X11 or wayland session). Many thanks to @Drakulix for the awesome work he's doing on the backends while I'm more focusing on frontend modules and interaction with the wayland protocol.

Can you contribute and how?

Yes you can! If you find this project interesting, don't hesitate to come! Even if you are not yet familiar with the wayland protocol.

Work on the backends of smithay actually require very little knowledge of wayland itself (but rather knowledge of libinput, drm, OpenGL, ...)

Work on the frontend and client modules do require knowledge of the wayland protocol, you can start having a look at the Rusty Wayland Handbook I have started to write, which for now only describe general wayland knowlegde and the core protocol, but aims to be a detailed tutorial on how to use wayland-client and wayland-server.

There is documentation that needs to be written, corrected, updated, (including the previously mentioned book !). And we also need to write a lot of tests for everything, they are currently pretty lacking...

And obviously, playing with the crates and giving us feedback of what is weird, unclear, missing or plainly wrong is a great way to help too!

If you want to get in touch, the github issues are a simple and direct way, even if just to ask a question. If you prefer chatting, we have a matrix room #smithay:matrix.org. This room is bridged to gitter if you prefer to use it: smithay/Lobby.

Thanks for your read, and welcome if you wish to work this us!