diff --git a/wallpaper_changer/src/wallpaper_changer/wallpaper_builder.py b/wallpaper_changer/src/wallpaper_changer/wallpaper_builder.py index d5c44cb..c3276c7 100644 --- a/wallpaper_changer/src/wallpaper_changer/wallpaper_builder.py +++ b/wallpaper_changer/src/wallpaper_changer/wallpaper_builder.py @@ -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(