Notification: add enable/disable toggle

This commit is contained in:
Ly-sec
2025-11-06 17:30:16 +01:00
parent 7211868c27
commit ceb2dea2a9
12 changed files with 81 additions and 6 deletions
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Transparenz der Benachrichtigungshintergründe anpassen.",
"label": "Hintergrund-Transparenz"
},
"enabled": {
"description": "Benachrichtigungs-Daemon aktivieren oder deaktivieren, erfordert einen Neustart von noctalia-shell.",
"label": "Benachrichtigungen aktivieren"
},
"do-not-disturb": {
"description": "Alle Benachrichtigungs-Popups deaktivieren.",
"label": "Nicht stören"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Adjust the opacity of notification backgrounds.",
"label": "Background opacity"
},
"enabled": {
"description": "Enable or disable the notification daemon, requires a restart of noctalia-shell.",
"label": "Enable notifications"
},
"do-not-disturb": {
"description": "Disable all notification popups when enabled.",
"label": "Do not disturb"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Ajustar la opacidad de los fondos de las notificaciones.",
"label": "Opacidad del fondo"
},
"enabled": {
"description": "Activar o desactivar el demonio de notificaciones, requiere reiniciar noctalia-shell.",
"label": "Activar notificaciones"
},
"do-not-disturb": {
"description": "Desactiva todas las ventanas emergentes de notificación cuando está activado.",
"label": "No molestar"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Ajuster l'opacité des arrière-plans de notifications.",
"label": "Opacité du fond"
},
"enabled": {
"description": "Activer ou désactiver le démon de notifications, nécessite un redémarrage de noctalia-shell.",
"label": "Activer les notifications"
},
"do-not-disturb": {
"description": "Désactive toutes les fenêtres de notification lorsque cette option est activée.",
"label": "Ne pas déranger"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Ajustar a opacidade dos fundos das notificações.",
"label": "Opacidade do fundo"
},
"enabled": {
"description": "Ativar ou desativar o daemon de notificações, requer reiniciar o noctalia-shell.",
"label": "Ativar notificações"
},
"do-not-disturb": {
"description": "Desativa todos os pop-ups de notificação quando ativado.",
"label": "Não perturbe"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Bildirim arka planlarının opaklığını ayarlayın.",
"label": "Arka plan opaklığı"
},
"enabled": {
"description": "Bildirim arka plan programını etkinleştir veya devre dışı bırak, noctalia-shell'in yeniden başlatılmasını gerektirir.",
"label": "Bildirimleri etkinleştir"
},
"do-not-disturb": {
"description": "Etkinleştirildiğinde tüm bildirim açılır pencerelerini devre dışı bırakır.",
"label": "Rahatsız etme"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "Налаштуйте непрозорість фону сповіщень.",
"label": "Непрозорість фону"
},
"enabled": {
"description": "Увімкнути або вимкнути демон сповіщень, вимагає перезапуску noctalia-shell.",
"label": "Увімкнути сповіщення"
},
"do-not-disturb": {
"description": "Вимкнути всі спливаючі сповіщення, коли увімкнено.",
"label": "Не турбувати"
+4
View File
@@ -1368,6 +1368,10 @@
"description": "调整通知背景的透明度。",
"label": "背景透明度"
},
"enabled": {
"description": "启用或禁用通知守护进程,需要重启 noctalia-shell。",
"label": "启用通知"
},
"do-not-disturb": {
"description": "启用后禁用所有通知弹出窗口。",
"label": "勿扰模式"
+1
View File
@@ -205,6 +205,7 @@
"wifiEnabled": true
},
"notifications": {
"enabled": true,
"doNotDisturb": false,
"monitors": [],
"location": "top_right",
+1
View File
@@ -341,6 +341,7 @@ Singleton {
// notifications
property JsonObject notifications: JsonObject {
property bool enabled: true
property bool doNotDisturb: false
property list<string> monitors: []
property string location: "top_right"
@@ -32,6 +32,13 @@ ColumnLayout {
description: I18n.tr("settings.notifications.settings.section.description")
}
NToggle {
label: I18n.tr("settings.notifications.settings.enabled.label")
description: I18n.tr("settings.notifications.settings.enabled.description")
checked: Settings.data.notifications.enabled !== false
onToggled: checked => Settings.data.notifications.enabled = checked
}
NToggle {
label: I18n.tr("settings.notifications.settings.do-not-disturb.label")
description: I18n.tr("settings.notifications.settings.do-not-disturb.description")
+40 -6
View File
@@ -76,12 +76,46 @@ Singleton {
}
}
// Notification server
NotificationServer {
keepOnReload: false
imageSupported: true
actionsSupported: true
onNotification: notification => handleNotification(notification)
// Notification server - only created when notifications are enabled
property var notificationServerLoader: null
Component {
id: notificationServerComponent
NotificationServer {
keepOnReload: false
imageSupported: true
actionsSupported: true
onNotification: notification => handleNotification(notification)
}
}
function updateNotificationServer() {
// Destroy existing server if it exists
if (notificationServerLoader) {
notificationServerLoader.destroy()
notificationServerLoader = null
}
// Create server only if enabled
if (Settings.isLoaded && Settings.data.notifications.enabled !== false) {
notificationServerLoader = notificationServerComponent.createObject(root)
}
}
Component.onCompleted: {
if (Settings.isLoaded) {
updateNotificationServer()
}
}
Connections {
target: Settings
function onSettingsLoaded() {
updateNotificationServer()
}
function onSettingsSaved() {
updateNotificationServer()
}
}
// Main handler