Migrating away from libastal
In a recent series of changes between Scarlet 0.3.0 and 0.4.0, I have been rewriting the backend based on libastal. Previously, Scarlet's backend was purely based on libastal, which was used for networking, audio control, battery management, notifications and everything in between. This was great at the beginning; it helped get Scarlet 0.1.0 out the door. This can no longer stand.
Brief history
Scarlet's backend was build from the libastal library, a useful library that provides scaffolding for wayland shell implementations. This library was originally design for Vala, but can also be used with python, lua and any language that supports gobject-introspection, one such language happened to be Rust.
Using the gir tool, I was able to generate Rust bindings for libastal in a single weekend. At the time, it was great. I could spend most of my effort improving the frontend and let libastal deal with the backend.
This was until a series of unexplained errors started occuring. A prevalent bug in Scarlet 0.3.0 is a bug that causes the application the segfault when receiving events for bluetooth or wifi. I tried debugging it, but to no avail. After tirelessly spinning in circles, attempting to debug the unexpected errors, I was encountering, I decided to make a change.
The rewrite
Originally, this decision was purely made to fix the segfault issues, but it quickly became more useful than anticipated. Primarily because it made Scarlet more portable, I could ship Scarlet to any Linux distribution without depending on packages that are not available for that distribution.
This rewrite has occurred over the span of Scarlet 0.3.0 and 0.4.0, with 0.3.0 detaching Scarlet from astal4, using gtk4-layer-shell and libadwaita. The latter release removes most of the astal-dependent backend, preserving network and battery, which will be rewritten in the next release.
Implications
For package management, this is a big win, Scarlet now has less dependencies, making it easier to package. There have been no observable changes in performance or resource usage, with those metrics generally remaining static. This has marginally increased the maintenance burden of Scarlet, but it is a burden I am happy to shoulder.
Closing thoughts
This round of changes marks the beginning of Scarlet's growth phase, moving away from the small project it once was to a larger, polished project. Scarlet 1.0 is still a long ways away. With this change, along with Scarlet's upcoming changes in the 0.5.0 release, Scarlet will take big step forward.