Notification: make doNotDisturb non persistent (fixes #665)

This commit is contained in:
Ly-sec
2025-11-10 17:12:51 +01:00
parent 97e24ac9b3
commit 5402ae32f5
8 changed files with 19 additions and 23 deletions
+5 -7
View File
@@ -21,6 +21,8 @@ Singleton {
// State
property real lastSeenTs: 0
// Volatile property that doesn't persist to settings (similar to noctaliaPerformanceMode)
property bool doNotDisturb: false
// Models
property ListModel activeList: ListModel {}
@@ -161,7 +163,7 @@ Singleton {
const data = createData(notification)
addToHistory(data)
if (Settings.data.notifications?.doNotDisturb || PowerProfileService.noctaliaPerformanceMode)
if (root.doNotDisturb || PowerProfileService.noctaliaPerformanceMode)
return
// Check if this is a replacement notification
@@ -728,11 +730,7 @@ Singleton {
// Signals
signal animateAndRemove(string notificationId)
Connections {
target: Settings.data.notifications
function onDoNotDisturbChanged() {
const enabled = Settings.data.notifications.doNotDisturb
ToastService.showNotice(enabled ? I18n.tr("toast.do-not-disturb.enabled") : I18n.tr("toast.do-not-disturb.disabled"), enabled ? I18n.tr("toast.do-not-disturb.enabled-desc") : I18n.tr("toast.do-not-disturb.disabled-desc"), enabled ? "bell-off" : "bell")
}
onDoNotDisturbChanged: {
ToastService.showNotice(doNotDisturb ? I18n.tr("toast.do-not-disturb.enabled") : I18n.tr("toast.do-not-disturb.disabled"), doNotDisturb ? I18n.tr("toast.do-not-disturb.enabled-desc") : I18n.tr("toast.do-not-disturb.disabled-desc"), doNotDisturb ? "bell-off" : "bell")
}
}