From e2a34210e58cbd593be63fd4b3e5d2d6257f5c37 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 7 Jul 2025 14:35:39 +1000 Subject: wallpaper: allow relative paths Fixes caelestia-dots/shell#200 --- src/caelestia/utils/wallpaper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/caelestia/utils') diff --git a/src/caelestia/utils/wallpaper.py b/src/caelestia/utils/wallpaper.py index abaf192..6c6532c 100644 --- a/src/caelestia/utils/wallpaper.py +++ b/src/caelestia/utils/wallpaper.py @@ -20,8 +20,7 @@ from caelestia.utils.scheme import Scheme, get_scheme from caelestia.utils.theme import apply_colours -def is_valid_image(path: Path | str) -> bool: - path = Path(path) +def is_valid_image(path: Path) -> bool: return path.is_file() and path.suffix in [".jpg", ".jpeg", ".png", ".webp", ".tif", ".tiff"] @@ -126,6 +125,9 @@ def get_colours_for_wall(wall: Path | str, no_smart: bool) -> None: def set_wallpaper(wall: Path | str, no_smart: bool) -> None: + # Make path absolute + wall = Path(wall).resolve() + if not is_valid_image(wall): raise ValueError(f'"{wall}" is not a valid image') -- cgit v1.2.3-freya