fix(wallpaper_changer): wallpaper bulder use correct dir, return image list

This commit is contained in:
Lucas Vivo committed 2026-11-13 18:11:11 +01:00
1 parent f0fd4a13e4
commit 7609177e35
1 file changed
+7 -5
@@ -19,13 +19,13 @@ class WallpaperBuilder:
images: Sequence[Mapping[str, Path | str]],
layout: ScreenLayout,
private_key: str | Path,
conf_dir: str | Path,
wallpaper_dir: Path,
search_terms: Sequence[str] | None = None,
exclude: Sequence[str] = (),
output_path: str | Path | None = None,
decode_and_leave: bool = False,
disable_encryption: bool = False,
) -> Path:
) -> tuple[Path,list]:
if not images:
raise ValueError("No images are available to build a wallpaper")
if not layout.monitors:
@@ -60,7 +60,7 @@ class WallpaperBuilder:
encryption_manager = (
None if disable_encryption else EncryptionManager()
)
images_used=[]
for monitor, image_record in zip(layout.monitors, selected_images):
source = self._open_image(
image_record,
@@ -94,17 +94,19 @@ class WallpaperBuilder:
stroke_width=1,
stroke_fill="black",
)
images_used.append(image_record['name'])
logger.info(f"Pasted image {image_record['name']} on monitor at x={monitor.x}, width={monitor.width}, height={monitor.height}")
destination = (
Path(output_path)
if output_path
else (Path(conf_dir).expanduser().resolve() / "current" / "wallpaper.jpg")
else (wallpaper_dir / "wallpaper.jpg")
)
destination.parent.mkdir(parents=True, exist_ok=True)
canvas.save(destination, format="JPEG", quality=95)
logger.info(f"Wallpaper built and saved to {destination}")
return destination
return destination, images_used
@staticmethod
def find_candidates(