Description
This project was a result of frustration with projects like Quickshell and shells built on it. The reliance on pure qml for building the entire shell application leads to a lot of tedium and poor practices such as tight coupling, and as impressive as Quickshell is as a framework, it feels quite limiting for someone more used to raw C++. Seeing as this is the case, I took the opportunity to step back down the tech stack and interact directly with Qt6 myself. This let me limit the amount of qml I had to write, and design the application architecture myself.
The ultimate goal is to have a fully functional suite of custom desktop shell components(fully featured top bar, launcher/power menu). As of now, I have a top bar that displays the time and currently focused window, as well as interactable indicators for niri workspaces.
Eventually, I'd also like to make the project compatible with all Wayland compositors that support the ext-workspace-v1 protocol extension, but for now it uses a backend module specialized for niri, as that's what I use on my desktop. The reason the generic Wayland backend was put on the back burner is because I ran into some strange quirks in how Qt's Wayland protocol extension is implemented, and I found interacting directly with niri over its IPC socket to be much simpler.
Source Code
The source code can be found here. Code examples will be added at a later date.
niri Module
When designing the broad architecture of this project, I decided on a modular approach that would let me create multiple backend implementations. The reason I did this despite only planning on using it on the one Wayland compositor that I use day to day, is twofold. First, explicitly separating the backend that interacts wit the compositor from the rest of the application via an interface makes it harder to become lazy and tightly couple things that ought to be independent in the pursuit of fast results, and second, I really want to properly explore Wayland protocols because I find the design philosophy fascinating. As a tertiary reason, it might also be cool to add more specialized backends at a later time for the sake of learning.
Communicating with the niri IPC was quite simple, if a bit tedious.
niri sends events to the Unix socket located at
$NIRI_SOCKET, and will provide events to any process
that requests it by sending the string EventStream over
that same socket. Thanks to the extensive documentation provided
here, it was a fairly simple job to translate the relevant Rust types
to C++ types, and feed those to
glaze to handle
serialization. The only real hiccups I ran into with this process
were that some of the niri types have variable names due to rust
enums, and that clangd doesn't yet understand P2996 reflection in
C++26. I was using reflection to simplify some of the serialization
logic for C++ enum values, and clangd kept throwing a fit about the
missing function definitions and the new operators.
Because I also separated the workspace manager module from the compositor backend module, the niri backend is paired with a thin wrapper class that simply forwards calls to the interface API directly to the specialized compositor backend.
Unfortunately, because of how data and event driven this section of the project is, there isn't actually much in terms of concise or interesting code examples I can show in this section, but I am quite happy with how it has turned out on a macro scale.