feat: actually set wallpaper

Make launcher wallpaper picker actually work
This commit is contained in:
2 * r + 2 * t 2025-05-04 16:29:34 +10:00
parent 0505ba8f92
commit 4c84e4fff3
4 changed files with 21 additions and 4 deletions

View file

@ -70,8 +70,8 @@ Item {
const currentItem = list.currentList?.currentItem;
if (currentItem) {
if (list.showWallpapers) {
// TODO
console.log(currentItem.modelData.path);
Wallpapers.setWallpaper(currentItem.modelData.path);
root.launcher.launcherVisible = false;
} else if (text.startsWith(LauncherConfig.actionPrefix)) {
currentItem.modelData.onClicked(list.currentList);
} else {

View file

@ -9,6 +9,7 @@ StyledRect {
id: root
required property Wallpapers.Wallpaper modelData
required property Scope launcher
scale: 0.5
opacity: 0
@ -26,7 +27,8 @@ StyledRect {
radius: Appearance.rounding.normal
function onClicked(): void {
console.log("clicked");
Wallpapers.setWallpaper(root.modelData.path);
root.launcher.launcherVisible = false;
}
}

View file

@ -31,7 +31,9 @@ PathView {
highlightRangeMode: PathView.StrictlyEnforceRange
highlightMoveDuration: Appearance.anim.durations.short
delegate: WallpaperItem {}
delegate: WallpaperItem {
launcher: root.launcher
}
path: Path {
startY: root.height / 2

View file

@ -26,6 +26,19 @@ Singleton {
}).map(r => r.obj.wall);
}
function setWallpaper(path: string): void {
setWall.path = path;
setWall.startDetached();
}
Process {
id: setWall
property string path
command: ["caelestia", "wallpaper", "-f", path]
}
Process {
running: true
command: ["fd", ".", root.path, "-t", "f", "-e", "jpg", "-e", "jpeg", "-e", "png", "-e", "svg"]