Files
bar/include/services/notificationController.hpp
2026-02-04 15:52:31 +01:00

37 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
#include <map>
#include <memory>
#include <sys/types.h>
#include <vector>
#include "connection/dbus/messages.hpp"
#include "widgets/notification/baseNotification.hpp"
#include "gdkmm/monitor.h"
class NotificationController {
static std::shared_ptr<NotificationController> instance;
public:
static std::shared_ptr<NotificationController> getInstance() {
if (!NotificationController::instance) {
NotificationController::instance = std::shared_ptr<NotificationController>(new NotificationController());
}
return NotificationController::instance;
}
void showSpotifyNotification(MprisPlayer2Message mpris);
void showNotificationOnAllMonitors(NotifyMessage notify);
void showCopyNotification(NotifyMessage notify);
private:
uint64_t globalNotificationId = 1;
std::map<uint64_t, std::vector<std::shared_ptr<BaseNotification>>> activeNotifications;
std::map<uint64_t, int> hoverCounts;
NotificationController();
std::vector<std::shared_ptr<Gdk::Monitor>> activeMonitors;
void updateHoverState(uint64_t notificationId, bool isHovered);
void closeNotification(uint64_t notificationId);
};