mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat: set if respecting custom notif timeout
This commit is contained in:
@@ -128,6 +128,7 @@
|
||||
"monitors": [],
|
||||
"location": "top_right",
|
||||
"lastSeenTs": 0,
|
||||
"respectExpireTimeout": false,
|
||||
"lowUrgencyDuration": 3,
|
||||
"normalUrgencyDuration": 8,
|
||||
"criticalUrgencyDuration": 15
|
||||
@@ -181,4 +182,4 @@
|
||||
"wallpaperChange": "",
|
||||
"darkModeChange": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user