Today's Dev #2

November 14, 2024

Today I spent time on my C++-based Budgie Daemon v2. For those not familiar, Budgie Daemon v2 is intended to serve as the foundation for any major daemon developments going forwards, eventually replacing functionality provided by the budgie-daemon that lives in the budgie-desktop repository for Budgie Desktop 10.x and acting as the beating heart for Budgie 11. At the moment, the focus is on interactions with Wayland protocols for display / output configuration and providing a DBus server for clients like Budgie Control Center to leverage for its graphical display configuration. After that the focus will be on global shortcut management. So anyways, the project started out as half an experiment and half my "hello world" for starting to learn C++. Since a lot of the references I used for Wayland-based display management were in C, the code took on a hybrid between the C and C++. It was at the state where I was able to get all my outputs and modes, read in my TOML-based configuration, and reliably apply the configuration to the outputs. I had also started on the DBus server, but decided before going too deep that I'd clean up all the code, make it more C++-like, and make it public so others (including on the team) can start dogfooding and using it. This cleanup has involved taking a lot of globally namespaces functions and wrapping them up in various bd namespaces or singleton classes (my favorite). As part of the refactoring, I want to make sure these new classes are inheriting from QObject so that we can take advantage of Qt's signal/slot system. For example, the config system and DBus server will know when the WaylandOutputManager has finished initializing, so we know we have all available outputs and can apply our initial configuration or allow state change over DBus. Well, unlike my experience working on Koto and singleton instances like Cartographer, having the classes in the daemon inherit from QObject has been a bit trickier today and I have been getting the following error whenever I call bd::WaylandOutputManager::instance() to get the instance:
error: call to implicitly-deleted copy constructor of 'WaylandOutputManager'
My suspicion is that this is due to having defined class members that are of the struct types zwlr_output_head_v1_listener, zwlr_output_mode_v1_listener, and zwlr_output_manager_v1_listener. Even after fixing the creation of those listeners to take either lambas that then call a static cast of the instance and call the appropriate listener, I still get the errors. 🤷 Tomorrow I am going to try making all of those listener structs be statically defined outside the class and have the functions call the singleton instance, remove the members from the WaylandOutputManager class, and hope that I don't get that copy constructor error further. Hopefully works out. 🤞 Finishing up my move from Meson to CMake was a small victory today at least. I decided last week or so that I wanted to port it over so I could leverage KDE's "extra cmake modules" (ECM) to easily find WaylandScanner and generate client source for Wayland protocols. Splitting up the CMakeLists.txt in a similar fashion as Koto (where the root CMake sets up the project and basically just adds the subdirectory, and the CMakeList in the src folder handles everything else) ironed out the remaining issues I had with the port!
Did you know?
You can follow me on Bluesky, Mastodon, or Threads!