aboutsummaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-19 09:18:55 +0200
committerDanilo M. <danix@danix.xyz>2026-10-19 09:18:55 +0200
commitd21ff23ed34048b4334c1183e8961b33d974969e (patch)
tree2e55ea39f556e0d70ab50aa7011999cabffe7f62 /shared
parenta6e3e42d0687dbc4a5b939faa3c2ca355e690e2e (diff)
downloadquickshell-d21ff23ed34048b4334c1183e8961b33d974969e.tar.gz
quickshell-d21ff23ed34048b4334c1183e8961b33d974969e.zip
notifications: read notifyd's config.json in the Notify singleton
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'shared')
-rw-r--r--shared/Notify.qml23
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 = {}
+ }
}