notifs: Implement notification dimissing (#4790)

This commit is contained in:
ItsDrike
2024-03-02 19:12:31 +01:00
committed by GitHub
parent 8811f4b69a
commit be89d6faa9
4 changed files with 37 additions and 0 deletions

View File

@@ -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;