From 2136b8c153f43524967dde4d1214e1093f31da0b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:02:42 +1000 Subject: colours: update for scheme refactor --- services/Colours.qml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'services/Colours.qml') diff --git a/services/Colours.qml b/services/Colours.qml index 4383972..3751240 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)) { @@ -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) -- cgit v1.2.3-freya From 4c475548afd9baf452a1d0ad134626a494d00c96 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 15 Jun 2025 14:11:07 +1000 Subject: colours: more fixes for cli rewrite Fix setting mode Fix wallpaper preview scheme --- services/Colours.qml | 2 +- services/Wallpapers.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'services/Colours.qml') diff --git a/services/Colours.qml b/services/Colours.qml index 3751240..ea3b02a 100644 --- a/services/Colours.qml +++ b/services/Colours.qml @@ -53,7 +53,7 @@ Singleton { } function setMode(mode: string): void { - setModeProc.command = ["caelestia", "scheme", "dynamic", "default", mode]; + setModeProc.command = ["caelestia", "scheme", "-m", mode]; setModeProc.startDetached(); } diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 44ca6a0..dd6a9f7 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -77,7 +77,7 @@ Singleton { Process { id: getPreviewColoursProc - command: ["caelestia", "scheme", "print", root.previewPath] + command: ["caelestia", "wallpaper", "-p", root.previewPath] stdout: SplitParser { splitMarker: "" onRead: data => { -- cgit v1.2.3-freya