Files
z-bar-qt/Helpers/Wallpapers.qml
T
Zacharias-Brohn 5d5d9575b6 general ipc calls
2026-02-18 23:39:06 +01:00

60 lines
1.8 KiB
QML

pragma Singleton
import Quickshell
import Quickshell.Io
import ZShell.Models
import qs.Config
import qs.Modules
import qs.Helpers
import qs.Paths
Searcher {
id: root
property bool showPreview: false
readonly property string current: showPreview ? previewPath : actualCurrent
property string previewPath
property string actualCurrent: WallpaperPath.currentWallpaperPath
function setWallpaper(path: string): void {
actualCurrent = path;
WallpaperPath.currentWallpaperPath = path;
Wallust.generateColors(WallpaperPath.currentWallpaperPath);
Quickshell.execDetached(["sh", "-c", `zshell-cli wallpaper lockscreen --input_image=${root.actualCurrent} --output_path=${Paths.state}/lockscreen_bg.png --blur_amount=${Config.lock.blurAmount}`]);
}
function preview(path: string): void {
previewPath = path;
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --path=${previewPath} --thumbnail=${Paths.cache}/imagecache/thumbnail.jpg --output=${Paths.state}/scheme.json --scheme=${Config.colors.schemeType}`]);
showPreview = true;
}
function stopPreview(): void {
showPreview = false;
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --path=${root.actualCurrent} --thumbnail=${Paths.cache}/imagecache/thumbnail.jpg --output=${Paths.state}/scheme.json --scheme=${Config.colors.schemeType}`]);
}
list: wallpapers.entries
key: "relativePath"
useFuzzy: true
extraOpts: useFuzzy ? ({}) : ({
forward: false
})
IpcHandler {
target: "wallpaper"
function set(path: string): void {
root.setWallpaper(path);
}
}
FileSystemModel {
id: wallpapers
recursive: true
path: Config.general.wallpaperPath
filter: FileSystemModel.Images
}
}