diff options
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/Notify.qml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/shared/Notify.qml b/shared/Notify.qml index cb1e2fe..a85ed6a 100644 --- a/shared/Notify.qml +++ b/shared/Notify.qml @@ -14,6 +14,7 @@ pragma Singleton import Quickshell import Quickshell.Io import QtQuick +import "NotifyConfig.js" as NC // The notification daemon's state, read from the files it publishes under // $XDG_RUNTIME_DIR/notifyd/. The files are the interface, the same convention @@ -47,6 +48,15 @@ Singleton { // value with none of the write side. property bool dnd: false + // ~/.config/notifyd/config.json, shared with the daemon (timeouts, caps) + // and written by the settings page. rawConfig is the parsed file as is, + // so a save keeps keys this version does not know; config is it resolved + // over the defaults, which is what everything reads. + readonly property string configPath: + (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/notifyd/config.json" + property var rawConfig: ({}) + readonly property var config: NC.resolve(root.rawConfig) + function parseQueue() { try { root.queue = JSON.parse(queueFile.text() || "[]"); } catch (e) { root.queue = []; } @@ -176,4 +186,17 @@ Singleton { } onLoadFailed: root.snoozeUntil = 0 } + + FileView { + id: configFile + path: root.configPath + watchChanges: true + printErrors: false + onFileChanged: reload() + onLoaded: { + try { root.rawConfig = JSON.parse(configFile.text() || "{}"); } + catch (e) { root.rawConfig = {}; } + } + onLoadFailed: root.rawConfig = {} + } } |
