diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-07 14:35:39 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-07 14:35:39 +1000 |
| commit | e2a34210e58cbd593be63fd4b3e5d2d6257f5c37 (patch) | |
| tree | 4122fb8b50fcca42fa21a39bf1f68487076bbae5 /src/caelestia | |
| parent | record: ensure recordings dir exists (diff) | |
| download | caelestia-cli-e2a34210e58cbd593be63fd4b3e5d2d6257f5c37.tar.gz caelestia-cli-e2a34210e58cbd593be63fd4b3e5d2d6257f5c37.tar.bz2 caelestia-cli-e2a34210e58cbd593be63fd4b3e5d2d6257f5c37.zip | |
wallpaper: allow relative paths
Fixes caelestia-dots/shell#200
Diffstat (limited to 'src/caelestia')
| -rw-r--r-- | src/caelestia/utils/wallpaper.py | 6 |
1 files changed, 4 insertions, 2 deletions
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') |