summaryrefslogtreecommitdiff
path: root/src/debug/HyprNotificationOverlay.hpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-03-20 15:02:47 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-03-20 15:03:09 +0000
commit71a95a581f86a801b1db24a417f41d9a395cab38 (patch)
treeae6167809c2586c84f0a640543bd85a83aca3ac2 /src/debug/HyprNotificationOverlay.hpp
parent788a8f7c134a34085d683e44a328e344be6b21f3 (diff)
feat: add pretty notifications
Diffstat (limited to 'src/debug/HyprNotificationOverlay.hpp')
-rw-r--r--src/debug/HyprNotificationOverlay.hpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp
index 12ad8e38..9f0a85ef 100644
--- a/src/debug/HyprNotificationOverlay.hpp
+++ b/src/debug/HyprNotificationOverlay.hpp
@@ -9,11 +9,36 @@
#include <cairo/cairo.h>
+enum eIconBackend
+{
+ ICONS_BACKEND_NONE = 0,
+ ICONS_BACKEND_NF,
+ ICONS_BACKEND_FA
+};
+
+enum eIcons
+{
+ ICON_WARNING = 0,
+ ICON_INFO,
+ ICON_HINT,
+ ICON_ERROR,
+ ICON_CONFUSED,
+ ICON_NONE
+};
+
+static const std::array<std::array<std::string, ICON_NONE + 1>, 3 /* backends */> ICONS_ARRAY = {std::array<std::string, ICON_NONE + 1>{"[!]", "[i]", "[Hint]", "[Err]", "[?]", ""},
+ std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", ""},
+ std::array<std::string, ICON_NONE + 1>{"", "", "", "", ""}};
+static const std::array<CColor, ICON_NONE + 1> 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{0, 0, 0, 1.0}};
+
struct SNotification {
std::string text = "";
CColor color;
CTimer started;
float timeMs = 0;
+ eIcons icon = ICON_NONE;
};
class CHyprNotificationOverlay {
@@ -21,7 +46,7 @@ class CHyprNotificationOverlay {
CHyprNotificationOverlay();
void draw(CMonitor* pMonitor);
- void addNotification(const std::string& text, const CColor& color, const float timeMs);
+ void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE);
private:
wlr_box drawNotifications(CMonitor* pMonitor);
@@ -35,6 +60,9 @@ class CHyprNotificationOverlay {
CMonitor* m_pLastMonitor = nullptr;
CTexture m_tTexture;
+
+ eIconBackend m_eIconBackend = ICONS_BACKEND_NONE;
+ std::string m_szIconFontName = "Sans";
};
inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay; \ No newline at end of file