#pragma once #include "../defines.hpp" #include "../helpers/Timer.hpp" #include "../helpers/Monitor.hpp" #include "../render/Texture.hpp" #include "../SharedDefs.hpp" #include #include enum eIconBackend { ICONS_BACKEND_NONE = 0, ICONS_BACKEND_NF, ICONS_BACKEND_FA }; static const std::array, 3 /* backends */> ICONS_ARRAY = { std::array{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""}, std::array{"", "", "", "", "", "󰸞", ""}, std::array{"", "", "", "", "", ""}}; static const std::array ICONS_COLORS = {CColor{255.0 / 255.0, 204 / 255.0, 102 / 255.0, 1.0}, CColor{128 / 255.0, 255 / 255.0, 255 / 255.0, 1.0}, CColor{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0}, CColor{255 / 255.0, 77 / 255.0, 77 / 255.0, 1.0}, CColor{255 / 255.0, 204 / 255.0, 153 / 255.0, 1.0}, CColor{128 / 255.0, 255 / 255.0, 128 / 255.0, 1.0}, CColor{0, 0, 0, 1.0}}; struct SNotification { std::string text = ""; CColor color; CTimer started; float timeMs = 0; eIcons icon = ICON_NONE; float fontSize = 13.f; }; class CHyprNotificationOverlay { public: CHyprNotificationOverlay(); ~CHyprNotificationOverlay(); void draw(PHLMONITOR pMonitor); void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE, const float fontSize = 13.f); void dismissNotifications(const int amount); bool hasAny(); private: CBox drawNotifications(PHLMONITOR pMonitor); CBox m_bLastDamage; std::deque> m_dNotifications; cairo_surface_t* m_pCairoSurface = nullptr; cairo_t* m_pCairo = nullptr; PHLMONITORREF m_pLastMonitor; Vector2D m_vecLastSize = Vector2D(-1, -1); SP m_pTexture; }; inline std::unique_ptr g_pHyprNotificationOverlay;