diff options
Diffstat (limited to 'desktop/modules/appearance/Hyprsunset.qml')
| -rw-r--r-- | desktop/modules/appearance/Hyprsunset.qml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/desktop/modules/appearance/Hyprsunset.qml b/desktop/modules/appearance/Hyprsunset.qml index 5886735..4befcb5 100644 --- a/desktop/modules/appearance/Hyprsunset.qml +++ b/desktop/modules/appearance/Hyprsunset.qml @@ -39,6 +39,12 @@ Singleton { property bool busy: false property bool confLoaded: false property bool appLoaded: false + // The two files as last read or written, to tell an unsaved edit: dirty + // is what save() would write differing from them. Discard is refresh(). + property string savedConf: "" + property string savedApp: "" + readonly property bool dirty: root.confLoaded && root.appLoaded + && (root.serializeProfiles(root.profiles) !== root.savedConf || root.appConfText() !== root.savedApp) readonly property string header: "# Managed by hyprsunset-qt. Edits here are overwritten on save.\n" @@ -166,6 +172,7 @@ profile { stdout: StdioCollector { onStreamFinished: { root.profiles = root.parseProfiles(text); + root.savedConf = root.serializeProfiles(root.profiles); root.confLoaded = true; } } @@ -202,6 +209,7 @@ profile { root.cachePathRaw = c["cache.path"] ?? "~/.config/hyprsunset-qt/sun.json"; root.cachePath = root.expandTilde(root.cachePathRaw); root.daemonCommand = c["daemon.command"] ?? "hyprsunset"; + root.savedApp = root.appConfText(); root.appLoaded = true; } } @@ -242,7 +250,9 @@ profile { root.notice = `invalid gamma: ${p.gamma}`; return; } } - confFile.setText(root.serializeProfiles(root.profiles)); + root.savedConf = root.serializeProfiles(root.profiles); + root.savedApp = root.appConfText(); + confFile.setText(root.savedConf); root.saveSettings(); root.restart(); root.notice = "saved + restarted"; |
