36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <sys/types.h>
|
|
#include <vector>
|
|
|
|
#include "services/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);
|
|
|
|
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);
|
|
}; |