diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-31 22:03:58 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-31 22:03:58 +1000 |
| commit | 7729546469a0f8517d639a9bc98554bd7ec13332 (patch) | |
| tree | c49bcdea57d211b14b43f9a3cfe706dc24ebae9a /services/Wallpapers.qml | |
| parent | plugin/cim: check if cache is valid image (diff) | |
| download | caelestia-shell-7729546469a0f8517d639a9bc98554bd7ec13332.tar.gz caelestia-shell-7729546469a0f8517d639a9bc98554bd7ec13332.tar.bz2 caelestia-shell-7729546469a0f8517d639a9bc98554bd7ec13332.zip | |
plugin: add FileSystemModel
Diffstat (limited to 'services/Wallpapers.qml')
| -rw-r--r-- | services/Wallpapers.qml | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 30d7b0e..9e2bf2d 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -2,6 +2,7 @@ pragma Singleton import qs.config import qs.utils +import Caelestia import Quickshell import Quickshell.Io import QtQuick @@ -39,7 +40,7 @@ Searcher { reloadableId: "wallpapers" - list: wallpapers.instances + list: wallpapers.files useFuzzy: Config.launcher.useFuzzy.wallpapers extraOpts: useFuzzy ? ({}) : ({ forward: false @@ -71,6 +72,13 @@ Searcher { } } + FileSystemModel { + id: wallpapers + + path: Paths.expandTilde(Paths.wallsdir) + filter: FileSystemModel.ImagesOnly + } + Process { id: getPreviewColoursProc @@ -82,49 +90,4 @@ Searcher { } } } - - Process { - id: getWallsProc - - running: true - command: ["find", "-L", Paths.expandTilde(Paths.wallsdir), "-type", "d", "-path", '*/.*', "-prune", "-o", "-not", "-name", '.*', "-type", "f", "-print"] - stdout: StdioCollector { - onStreamFinished: wallpapers.model = text.trim().split("\n").filter(w => Images.isValidImageByName(w)).sort() - } - } - - Process { - id: watchWallsProc - - running: true - command: ["inotifywait", "-r", "-e", "close_write,moved_to,create", "-m", Paths.expandTilde(Paths.wallsdir)] - stdout: SplitParser { - onRead: data => { - if (Images.isValidImageByName(data)) - getWallsProc.running = true; - } - } - } - - Connections { - target: Config.paths - - function onWallpaperDirChanged(): void { - getWallsProc.running = true; - watchWallsProc.running = false; - watchWallsProc.running = true; - } - } - - Variants { - id: wallpapers - - Wallpaper {} - } - - component Wallpaper: QtObject { - required property string modelData - readonly property string path: modelData - readonly property string name: path.slice(Paths.expandTilde(Paths.wallsdir).length + 1, path.lastIndexOf(".")) - } } |