From be89d6faa988f6bd33a66f02746872c649a16180 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 2 Mar 2024 19:12:31 +0100 Subject: notifs: Implement notification dimissing (#4790) --- src/debug/HyprNotificationOverlay.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/debug/HyprNotificationOverlay.cpp') diff --git a/src/debug/HyprNotificationOverlay.cpp b/src/debug/HyprNotificationOverlay.cpp index 2968134b..98c68f1f 100644 --- a/src/debug/HyprNotificationOverlay.cpp +++ b/src/debug/HyprNotificationOverlay.cpp @@ -50,6 +50,18 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC } } +void CHyprNotificationOverlay::dismissNotifications(const int amount) { + if (amount == -1) + m_dNotifications.clear(); + else { + const int AMT = std::min(amount, static_cast(m_dNotifications.size())); + + for (int i = 0; i < AMT; ++i) { + m_dNotifications.pop_front(); + } + } +} + CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) { static constexpr auto ANIM_DURATION_MS = 600.0; static constexpr auto ANIM_LAG_MS = 100.0; -- cgit v1.2.3