diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 12:27:50 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 12:27:50 +0200 |
| commit | d10b5de495184f002f3ed7b4738c5650b6f7b7f3 (patch) | |
| tree | 0c16b73529024dfd5a51dce4b539fd0fdd6ea4bd /appearance | |
| parent | a8fba0cb72f7bfcff9013e5e28a4dfdfd9d1a872 (diff) | |
| download | quickshell-d10b5de495184f002f3ed7b4738c5650b6f7b7f3.tar.gz quickshell-d10b5de495184f002f3ed7b4738c5650b6f7b7f3.zip | |
fix(appearance): preserve the raw cache path on settings save
appConfText() hardcoded path = ~/.config/hyprsunset-qt/sun.json, so any
saveSettings() -- from save() or detect() -- silently reset a user-customized
cache path while fetchSun() kept writing to the parsed location. Mirror
sunset-qt's settings.py: hold the raw unexpanded string in cachePathRaw for
serialization and derive the expanded cachePath for file access, so a no-op
save is byte-identical and the two stay consistent.
Diffstat (limited to 'appearance')
| -rw-r--r-- | appearance/Hyprsunset.qml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/appearance/Hyprsunset.qml b/appearance/Hyprsunset.qml index acfc365..ea389fd 100644 --- a/appearance/Hyprsunset.qml +++ b/appearance/Hyprsunset.qml @@ -31,6 +31,7 @@ Singleton { property string lon: "" property bool autoDetect: true property string daemonCommand: "hyprsunset" + property string cachePathRaw: "~/.config/hyprsunset-qt/sun.json" property string cachePath: `${home}/.config/hyprsunset-qt/sun.json` property string notice: "" property string sunSummary: "" @@ -190,7 +191,8 @@ profile { root.lat = c["location.lat"] ?? ""; root.lon = c["location.lon"] ?? ""; root.autoDetect = (c["location.auto_detect"] ?? "true") === "true"; - root.cachePath = root.expandTilde(c["cache.path"] ?? "~/.config/hyprsunset-qt/sun.json"); + root.cachePathRaw = c["cache.path"] ?? "~/.config/hyprsunset-qt/sun.json"; + root.cachePath = root.expandTilde(root.cachePathRaw); root.daemonCommand = c["daemon.command"] ?? "hyprsunset"; } } @@ -203,7 +205,7 @@ profile { function appConfText() { return `[location]\nlat = ${root.lat}\nlon = ${root.lon}\n` + `auto_detect = ${root.autoDetect}\n\n` + - `[cache]\npath = ~/.config/hyprsunset-qt/sun.json\n\n` + + `[cache]\npath = ${root.cachePathRaw}\n\n` + `[daemon]\ncommand = ${root.daemonCommand}\n\n`; } function saveSettings() { appFile.setText(root.appConfText()); } |
