diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-05 17:06:12 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-05 17:06:12 +1000 |
| commit | 97ea9d49929b223036e96388c66d700ea731d6db (patch) | |
| tree | 74b80e05731e7c14903a253b2d972731584f375f /services/Wallpapers.qml | |
| parent | feat: wallpaper (diff) | |
| download | caelestia-shell-97ea9d49929b223036e96388c66d700ea731d6db.tar.gz caelestia-shell-97ea9d49929b223036e96388c66d700ea731d6db.tar.bz2 caelestia-shell-97ea9d49929b223036e96388c66d700ea731d6db.zip | |
feat: wallpaper and colour preview
Diffstat (limited to 'services/Wallpapers.qml')
| -rw-r--r-- | services/Wallpapers.qml | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 8e98e32..1d2a097 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -9,13 +9,13 @@ import Qt.labs.platform Singleton { id: root - readonly property string currentPath: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/wallpaper/last.txt`.slice(7) + readonly property string currentNamePath: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/wallpaper/last.txt`.slice(7) readonly property string path: `${StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]}/Wallpapers`.slice(7) property list<Wallpaper> list property bool showPreview: false - readonly property string current: showPreview ? preview : actualCurrent - property string preview + readonly property string current: showPreview ? previewPath : actualCurrent + property string previewPath property string actualCurrent readonly property list<var> preppedWalls: list.map(w => ({ @@ -33,20 +33,45 @@ Singleton { } function setWallpaper(path: string): void { + actualCurrent = path; setWall.path = path; setWall.startDetached(); } + function preview(path: string): void { + previewPath = path; + showPreview = true; + getPreviewColoursProc.running = true; + } + + function stopPreview(): void { + showPreview = false; + Colours.showPreview = false; + } + reloadableId: "wallpapers" FileView { - path: root.currentPath + path: root.currentNamePath watchChanges: true onFileChanged: reload() onLoaded: root.actualCurrent = text().trim() } Process { + id: getPreviewColoursProc + + command: ["caelestia", "scheme", "print", root.previewPath] + stdout: SplitParser { + splitMarker: "" + onRead: data => { + Colours.load(data, true); + Colours.showPreview = true; + } + } + } + + Process { id: setWall property string path |