@@ -368,16 +368,33 @@ Item {
368368 return Settings.data.colorSchemes.darkMode ? "dark" : "light";
369369 }
370370
371- function applyWallpaperColorsFromScreenshot(screenshotPath) {
371+ function syncWallpaperColorSource(screenName, screenshotPath) {
372+ const normalizedScreenName = String(screenName || "").trim();
373+ const normalizedScreenshotPath = String(screenshotPath || "").trim();
374+ if (normalizedScreenName.length === 0 || normalizedScreenshotPath.length === 0) {
375+ return;
376+ }
377+
378+ WallpaperService.changeWallpaper(normalizedScreenshotPath, normalizedScreenName, "dark");
379+ WallpaperService.changeWallpaper(normalizedScreenshotPath, normalizedScreenName, "light");
380+ }
381+
382+ function applyWallpaperColorsFromScreenshot(screenName, screenshotPath) {
372383 if (String(screenshotPath || "").trim().length === 0) {
373384 return;
374385 }
375386
387+ syncWallpaperColorSource(screenName, screenshotPath);
376388 TemplateProcessor.processWallpaperColors(screenshotPath, currentWallpaperColorMode());
377389 }
378390
379391 function screenshotPathForWallpaper(path, screenName = "") {
380- return ColorCacheHelpers.screenshotPathForWallpaper(Settings.cacheDir, wallpaperIdFromPath(path), screenName);
392+ return ColorCacheHelpers.screenshotPathForWallpaper(
393+ Settings.cacheDir,
394+ pluginApi?.manifest?.id || pluginApi?.pluginId || "linux-wallpaperengine-controller",
395+ wallpaperIdFromPath(path),
396+ screenName
397+ );
381398 }
382399
383400 function wallpaperColorScreenshotEntry(screenName) {
@@ -903,10 +920,6 @@ Item {
903920 }
904921 }
905922
906- if (firstPath.length > 0) {
907- command.push(firstPath);
908- }
909-
910923 return command;
911924 }
912925
@@ -1219,7 +1232,7 @@ Item {
12191232 saveWallpaperColorScreenshot(screenName, screenshotPath, requestPath, root.wallpaperColorScaling);
12201233
12211234 if (wallpaperColorsEnabled && screenName === activeColorMonitor) {
1222- root.applyWallpaperColorsFromScreenshot(screenshotPath);
1235+ root.applyWallpaperColorsFromScreenshot(screenName, screenshotPath);
12231236 Logger.i("LWEController", "Wallpaper screenshot generated and applied for active color monitor", "path=", requestPath, "screen=", screenName, "screenshot=", screenshotPath);
12241237 ToastService.showNotice(pluginApi?.tr("panel.title"), pluginApi?.tr("toast.wallpaperColorsApplied"), "palette");
12251238 return;
@@ -1245,7 +1258,7 @@ Item {
12451258 Logger.i("LWEController", "Reusing cached wallpaper color screenshot", "path=", request.wallpaperPath, "screen=", request.screenName, "scaling=", request.scaling, "screenshot=", request.screenshotPath);
12461259
12471260 if (root.wallpaperColorsEnabled && request.screenName === root.activeColorMonitor) {
1248- root.applyWallpaperColorsFromScreenshot(request.screenshotPath);
1261+ root.applyWallpaperColorsFromScreenshot(request.screenName, request. screenshotPath);
12491262 ToastService.showNotice(pluginApi?.tr("panel.title"), pluginApi?.tr("toast.wallpaperColorsApplied"), "palette");
12501263 } else {
12511264 ToastService.showNotice(pluginApi?.tr("panel.title"), pluginApi?.tr("toast.wallpaperColorsCached"), "palette");
@@ -1310,7 +1323,7 @@ Item {
13101323 return;
13111324 }
13121325 Logger.i("LWEController", "Applying cached wallpaper colors for active monitor", "screen=", screenName || root.activeColorMonitor, "path=", screenshotPath);
1313- root.applyWallpaperColorsFromScreenshot(screenshotPath);
1326+ root.applyWallpaperColorsFromScreenshot(screenName || root.activeColorMonitor, screenshotPath);
13141327 }
13151328 }
13161329
0 commit comments