feat: set if respecting custom notif timeout

This commit is contained in:
FUFSoB
2025-09-23 10:53:44 +05:00
parent 2d0d6207a1
commit b47ac6dd8a
5 changed files with 18 additions and 2 deletions
+2 -1
View File
@@ -128,6 +128,7 @@
"monitors": [],
"location": "top_right",
"lastSeenTs": 0,
"respectExpireTimeout": false,
"lowUrgencyDuration": 3,
"normalUrgencyDuration": 8,
"criticalUrgencyDuration": 15
@@ -181,4 +182,4 @@
"wallpaperChange": "",
"darkModeChange": ""
}
}
}
+1
View File
@@ -249,6 +249,7 @@ Singleton {
property list<string> monitors: []
property string location: "top_right"
property real lastSeenTs: 0
property bool respectExpireTimeout: false
property int lowUrgencyDuration: 3
property int normalUrgencyDuration: 8
property int criticalUrgencyDuration: 15
+1
View File
@@ -39,6 +39,7 @@ Variants {
screen: modelData
WlrLayershell.namespace: "noctalia-notifications"
WlrLayershell.layer: WlrLayer.Top
color: Color.transparent
@@ -89,6 +89,14 @@ ColumnLayout {
description: "Configure how long notifications stay visible based on their urgency level."
}
// Respect Expire Timeout (eg. --expire-time flag in notify-send)
NToggle {
label: "Respect expire timeout"
description: "Use the expire timeout set in the notification."
checked: Settings.data.notifications.respectExpireTimeout
onToggled: checked => Settings.data.notifications.respectExpireTimeout = checked
}
// Low Urgency Duration
ColumnLayout {
spacing: Style.marginXXS * scaling
+6 -1
View File
@@ -192,7 +192,12 @@ Singleton {
for (var i = activeList.count - 1; i >= 0; i--) {
const notif = activeList.get(i)
const elapsed = now - notif.timestamp.getTime()
const expire = notif.expireTimeout > 0 ? notif.expireTimeout : durations[notif.urgency]
var expire = 0
if (Settings.data.notifications?.respectExpireTimeout)
expire = notif.expireTimeout > 0 ? notif.expireTimeout : durations[notif.urgency]
else
expire = durations[notif.urgency]
const progress = Math.max(1.0 - (elapsed / expire), 0.0)
updateModel(activeList, notif.id, "progress", progress)