notifications: hover prevents timeout

This commit is contained in:
end-4
2025-08-19 21:15:59 +07:00
parent 7cbc707308
commit 891a226fdb
2 changed files with 18 additions and 1 deletions
@@ -10,7 +10,7 @@ import Quickshell
* A group of notifications from the same app.
* Similar to Android's notifications
*/
Item { // Notification group area
MouseArea { // Notification group area
id: root
property var notificationGroup
property var notifications: notificationGroup?.notifications ?? []
@@ -38,6 +38,17 @@ Item { // Notification group area
destroyAnimation.running = true;
}
hoverEnabled: true
onContainsMouseChanged: {
if (!root.popup) return;
if (root.containsMouse) root.notifications.forEach(notif => {
Notifications.cancelTimeout(notif.notificationId);
});
else root.notifications.forEach(notif => {
Notifications.timeoutNotification(notif.notificationId);
});
}
SequentialAnimation { // Drag finish animation
id: destroyAnimation
running: false
@@ -204,6 +204,12 @@ Singleton {
root.discardAll();
}
function cancelTimeout(id) {
const index = root.list.findIndex((notif) => notif.notificationId === id);
if (root.list[index] != null)
root.list[index].timer.stop();
}
function timeoutNotification(id) {
const index = root.list.findIndex((notif) => notif.notificationId === id);
if (root.list[index] != null)