diff options
| author | Tim Hämisch <tim@thaemisch.net> | 2025-06-15 13:40:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 13:40:47 +0200 |
| commit | 68874082b4cfee63feaecc0640646ad0ba753da7 (patch) | |
| tree | 815a1113a4bd83373283253a35f0220a08a8cfe6 /services/Colours.qml | |
| parent | launcher: use standard logout command (diff) | |
| parent | dashboard: fix uptime (diff) | |
| download | caelestia-shell-68874082b4cfee63feaecc0640646ad0ba753da7.tar.gz caelestia-shell-68874082b4cfee63feaecc0640646ad0ba753da7.tar.bz2 caelestia-shell-68874082b4cfee63feaecc0640646ad0ba753da7.zip | |
Merge branch 'main' into betteractions
Diffstat (limited to 'services/Colours.qml')
| -rw-r--r-- | services/Colours.qml | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/services/Colours.qml b/services/Colours.qml index 4383972..ea3b02a 100644 --- a/services/Colours.qml +++ b/services/Colours.qml @@ -36,12 +36,14 @@ Singleton { function load(data: string, isPreview: bool): void { const colours = isPreview ? preview : current; - for (const line of data.trim().split("\n")) { - let [name, colour] = line.split(" "); - name = name.trim(); - name = colourNames.includes(name) ? name : `m3${name}`; - if (colours.hasOwnProperty(name)) - colours[name] = `#${colour.trim()}`; + const scheme = JSON.parse(data); + + light = scheme.mode === "light"; + + for (const [name, colour] of Object.entries(scheme.colours)) { + const propName = colourNames.includes(name) ? name : `m3${name}`; + if (colours.hasOwnProperty(propName)) + colours[propName] = `#${colour}`; } if (!isPreview || (isPreview && endPreviewOnNextChange)) { @@ -51,7 +53,7 @@ Singleton { } function setMode(mode: string): void { - setModeProc.command = ["caelestia", "scheme", "dynamic", "default", mode]; + setModeProc.command = ["caelestia", "scheme", "-m", mode]; setModeProc.startDetached(); } @@ -60,14 +62,7 @@ Singleton { } FileView { - path: `${Paths.state}/scheme/current-mode.txt` - watchChanges: true - onFileChanged: reload() - onLoaded: root.light = text() === "light" - } - - FileView { - path: `${Paths.state}/scheme/current.txt` + path: `${Paths.state}/scheme.json` watchChanges: true onFileChanged: reload() onLoaded: root.load(text(), false) |