diff options
Diffstat (limited to 'services')
| -rw-r--r-- | services/Colours.qml | 23 | ||||
| -rw-r--r-- | services/Wallpapers.qml | 4 |
2 files changed, 11 insertions, 16 deletions
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) diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 3f6bf15..44ca6a0 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -9,7 +9,7 @@ import QtQuick Singleton { id: root - readonly property string currentNamePath: `${Paths.state}/wallpaper/last.txt`.slice(7) + readonly property string currentNamePath: `${Paths.state}/wallpaper/path.txt`.slice(7) readonly property string path: `${Paths.pictures}/Wallpapers`.slice(7) readonly property list<Wallpaper> list: wallpapers.instances @@ -97,7 +97,7 @@ Singleton { Process { running: true - command: ["fd", ".", root.path, "-t", "f", "-e", "jpg", "-e", "jpeg", "-e", "png", "-e", "svg"] + command: ["fd", ".", root.path, "-t", "f", "-e", "jpg", "-e", "jpeg", "-e", "png", "-e", "webp", "-e", "tif", "-e", "tiff"] stdout: SplitParser { splitMarker: "" onRead: data => wallpapers.model = data.trim().split("\n") |