diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-17 11:37:12 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-17 11:37:12 +0200 |
| commit | f73b88072b7abad720923dd32bae6a1e98bf64d5 (patch) | |
| tree | 2130fda0e99a0f09a2c6ee6030cd785d6d32f8f6 /desktop/modules/appearance/Hyprsunset.qml | |
| parent | 080d3d9aaffa8848d6de8546511f096d8e7c30f5 (diff) | |
| download | quickshell-f73b88072b7abad720923dd32bae6a1e98bf64d5.tar.gz quickshell-f73b88072b7abad720923dd32bae6a1e98bf64d5.zip | |
settings: every page commits from the header
The Mail, Assistant and Ask presets pages got a Save and Discard pair in
the page header; the rest still had their own buttons wherever their
page put them: User's Save at the bottom, Wallpaper's Apply and Reset
beside the mock screens, Icons' Apply and Reset under the cursor cards,
HyprSunset's and HyprIdle's Save + Restart in the page. They now all sit
in the header SaveBar, which takes the page's own verbs (Apply and
Reset, Save + Restart) and a busy state.
HyprSunset and HyprIdle had no notion of an unsaved change, so their
button was always live. They now count as changed when what save()
would write differs from what was read, which enables Save only then,
gives Discard (a reload) something to drop, and marks them in the
sidebar; a window open no longer reloads them over unsaved edits. The
staged cursor moved from IconsTab into the Icons singleton so the
header and the sidebar can see it.
Git and autostart act a row at a time, and a theme applies on click, so
those have no bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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"; |
