diff options
| author | ItsDrike <itsdrike@protonmail.com> | 2024-03-02 19:12:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-02 18:12:31 +0000 |
| commit | be89d6faa988f6bd33a66f02746872c649a16180 (patch) | |
| tree | 1e2bfbf8d184a7209a5b973c42a869931572f8ef /src/debug/HyprNotificationOverlay.cpp | |
| parent | 8811f4b69ade469285635c539f20194d717c8e17 (diff) | |
notifs: Implement notification dimissing (#4790)
Diffstat (limited to 'src/debug/HyprNotificationOverlay.cpp')
| -rw-r--r-- | src/debug/HyprNotificationOverlay.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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<int>(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; |
