diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 32d22f1c..b922253d 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -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" diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index abaaef25..d44b166f 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -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" diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 00b504e1..2904fb0d 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -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" diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index f19ac6ef..8c7fb745 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -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" diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 2adfcc5e..bc9baeff 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -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" diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index aad2de6f..23c8efa1 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -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" diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index 7cb4e0fa..ab01e87e 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -1368,6 +1368,10 @@ "description": "Налаштуйте непрозорість фону сповіщень.", "label": "Непрозорість фону" }, + "enabled": { + "description": "Увімкнути або вимкнути демон сповіщень, вимагає перезапуску noctalia-shell.", + "label": "Увімкнути сповіщення" + }, "do-not-disturb": { "description": "Вимкнути всі спливаючі сповіщення, коли увімкнено.", "label": "Не турбувати" diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 4f4c225e..117374c5 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -1368,6 +1368,10 @@ "description": "调整通知背景的透明度。", "label": "背景透明度" }, + "enabled": { + "description": "启用或禁用通知守护进程,需要重启 noctalia-shell。", + "label": "启用通知" + }, "do-not-disturb": { "description": "启用后禁用所有通知弹出窗口。", "label": "勿扰模式" diff --git a/Assets/settings-default.json b/Assets/settings-default.json index e6b28d3f..684b72db 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -205,6 +205,7 @@ "wifiEnabled": true }, "notifications": { + "enabled": true, "doNotDisturb": false, "monitors": [], "location": "top_right", diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 0eb314dd..c5d3a51b 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -341,6 +341,7 @@ Singleton { // notifications property JsonObject notifications: JsonObject { + property bool enabled: true property bool doNotDisturb: false property list monitors: [] property string location: "top_right" diff --git a/Modules/Panels/Settings/Tabs/NotificationsTab.qml b/Modules/Panels/Settings/Tabs/NotificationsTab.qml index bdfe4d03..5b7a647d 100644 --- a/Modules/Panels/Settings/Tabs/NotificationsTab.qml +++ b/Modules/Panels/Settings/Tabs/NotificationsTab.qml @@ -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") diff --git a/Services/NotificationService.qml b/Services/NotificationService.qml index 72277372..5ef0a705 100644 --- a/Services/NotificationService.qml +++ b/Services/NotificationService.qml @@ -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