From 06ffd6d767d19b2df31d907184c410e9f1ef66fd Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 27 Jun 2025 22:11:10 +1000 Subject: wallpapers: watch wallpaper dir for changes --- services/Wallpapers.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'services/Wallpapers.qml') diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 4bce290..eea4cb4 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -103,11 +103,26 @@ Singleton { } } + Process { + id: watchWallsProc + + running: true + command: ["inotifywait", "-r", "-e", "close_write,moved_to,create", "-m", Config.paths.wallpaperDir] + stdout: SplitParser { + onRead: data => { + if (root.extensions.includes(data.slice(data.lastIndexOf(".") + 1))) + getWallsProc.running = true; + } + } + } + Connections { target: Config.paths function onWallpaperDirChanged(): void { getWallsProc.running = true; + watchWallsProc.running = false; + watchWallsProc.running = true; } } -- cgit v1.2.3-freya