Skip to content

Commit 8b26f21

Browse files
committed
quickshell/notifications: add expiry handler
1 parent e6f3f6e commit 8b26f21

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

home/services/quickshell/notifications/NotificationOverlay.qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,18 @@ PanelWindow {
3434
model: NotificationState.popupNotifs
3535

3636
NotificationBox {
37+
id: notifBox
3738
required property int index
3839
n: NotificationState.popupNotifs[index]
3940
indexPopup: index
41+
42+
Timer {
43+
running: true
44+
interval: (notifBox.n.expireTimeout > 0 ? notifBox.n.expireTimeout : Config.notificationExpireTimeout) * 1000
45+
onTriggered: {
46+
NotificationState.notifDismissByNotif(notifBox.n);
47+
}
48+
}
4049
}
4150
}
4251
}

home/services/quickshell/utils/Config.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ Singleton {
1111
return mon;
1212
}
1313
}
14+
15+
readonly property var notificationExpireTimeout: 10
1416
}

home/services/quickshell/utils/NotificationState.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Singleton {
8888
onNotification: notif => {
8989
notif.tracked = true;
9090
root.onNewNotif(notif);
91-
console.log("notif: appName", notif.appName || "null", ", appIcon", notif.appIcon || "null", ", image", notif.image || "null")
91+
console.log("notif: appName", notif.appName || "null", ", appIcon", notif.appIcon || "null", ", image", notif.image || "null", ", expireTimeout", notif.expireTimeout)
9292

9393
notif.closed.connect(() => {
9494
notifDismissByNotif(notif);

0 commit comments

Comments
 (0)