fix bar crashing on monitor add/remove

This commit is contained in:
2026-02-09 13:49:52 +01:00
parent a90d1c2f6c
commit e1217305a5
30 changed files with 1186 additions and 247 deletions

View File

@@ -4,6 +4,7 @@
#include <giomm.h>
#include <gtkmm.h>
#include <sigc++/sigc++.h>
#include <sys/stat.h>
#include "connection/dbus/dbus.hpp"
@@ -43,7 +44,17 @@ const Glib::ustring introspection_xml = R"(
class NotificationService : public DbusConnection {
public:
NotificationService() : notificationIdCounter(1) {
static std::shared_ptr<NotificationService> getInstance() {
if (NotificationService::instance == nullptr) {
NotificationService::instance = std::shared_ptr<NotificationService>(new NotificationService());
}
return NotificationService::instance;
}
void onBusAcquired(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name);
private:
NotificationService() {
Gio::DBus::own_name(
Gio::DBus::BusType::SESSION,
"org.freedesktop.Notifications",
@@ -53,10 +64,9 @@ class NotificationService : public DbusConnection {
Gio::DBus::BusNameOwnerFlags::REPLACE);
}
void onBusAcquired(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name);
static inline std::shared_ptr<NotificationService> instance = nullptr;
private:
guint notificationIdCounter;
guint notificationIdCounter = 0;
const Gio::DBus::InterfaceVTable &getMessageInterfaceVTable();
void on_method_call(const Glib::RefPtr<Gio::DBus::Connection> &connection,
const Glib::ustring &sender,