forked from Shinonome/dots-hyprland
notifications: hover prevents timeout
This commit is contained in:
@@ -10,7 +10,7 @@ import Quickshell
|
|||||||
* A group of notifications from the same app.
|
* A group of notifications from the same app.
|
||||||
* Similar to Android's notifications
|
* Similar to Android's notifications
|
||||||
*/
|
*/
|
||||||
Item { // Notification group area
|
MouseArea { // Notification group area
|
||||||
id: root
|
id: root
|
||||||
property var notificationGroup
|
property var notificationGroup
|
||||||
property var notifications: notificationGroup?.notifications ?? []
|
property var notifications: notificationGroup?.notifications ?? []
|
||||||
@@ -38,6 +38,17 @@ Item { // Notification group area
|
|||||||
destroyAnimation.running = true;
|
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
|
SequentialAnimation { // Drag finish animation
|
||||||
id: destroyAnimation
|
id: destroyAnimation
|
||||||
running: false
|
running: false
|
||||||
|
|||||||
@@ -204,6 +204,12 @@ Singleton {
|
|||||||
root.discardAll();
|
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) {
|
function timeoutNotification(id) {
|
||||||
const index = root.list.findIndex((notif) => notif.notificationId === id);
|
const index = root.list.findIndex((notif) => notif.notificationId === id);
|
||||||
if (root.list[index] != null)
|
if (root.list[index] != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user