From 4cce7f60a9c8772d18ffb43cb74aa227ab4b3bc4 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:56:25 +0100 Subject: notifications: move and small refactor (#14094) moves to notification/, and adds a new style manager getter. --- src/debug/HyprNotificationOverlay.hpp | 72 ----------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/debug/HyprNotificationOverlay.hpp (limited to 'src/debug/HyprNotificationOverlay.hpp') diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp deleted file mode 100644 index e8cbf56a..00000000 --- a/src/debug/HyprNotificationOverlay.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include "../defines.hpp" -#include "../helpers/time/Timer.hpp" -#include "../render/Texture.hpp" -#include "../SharedDefs.hpp" - -#include - -enum eIconBackend : uint8_t { - 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 = {CHyprColor{1.0, 204 / 255.0, 102 / 255.0, 1.0}, - CHyprColor{128 / 255.0, 255 / 255.0, 255 / 255.0, 1.0}, - CHyprColor{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0}, - CHyprColor{255 / 255.0, 77 / 255.0, 77 / 255.0, 1.0}, - CHyprColor{255 / 255.0, 204 / 255.0, 153 / 255.0, 1.0}, - CHyprColor{128 / 255.0, 255 / 255.0, 128 / 255.0, 1.0}, - CHyprColor{0, 0, 0, 1.0}}; - -struct SNotification { - struct SRenderCache { - SP textTex; - SP iconTex; - - Vector2D textSize = {}; - Vector2D iconSize = {}; - - PHLMONITORREF monitor; - std::string fontFamily; - int fontSizePx = -1; - eIconBackend iconBackend = ICONS_BACKEND_NONE; - } cache; - - std::string text = ""; - CHyprColor 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 CHyprColor& color, const float timeMs, const eIcons icon = ICON_NONE, const float fontSize = 13.f); - void dismissNotifications(const int amount); - bool hasAny(); - - private: - void ensureNotificationCache(SNotification& notif, PHLMONITOR pMonitor, const std::string& fontFamily); - eIconBackend iconBackendForFont(const std::string& fontFamily); - CBox drawNotifications(PHLMONITOR pMonitor); - CBox m_lastDamage; - - std::vector> m_notifications; - - std::string m_cachedIconBackendFontFamily; - eIconBackend m_cachedIconBackend = ICONS_BACKEND_NONE; - bool m_iconBackendValid = false; -}; - -inline UP g_pHyprNotificationOverlay; -- cgit v1.2.3