From d10b5de495184f002f3ed7b4738c5650b6f7b7f3 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 16 Sep 2026 12:27:50 +0200 Subject: 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. --- appearance/Hyprsunset.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'appearance/Hyprsunset.qml') 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()); } -- cgit v1.2.3