wallpaper: allow relative paths

Fixes caelestia-dots/shell#200
This commit is contained in:
2 * r + 2 * t
2025-07-07 14:35:39 +10:00
parent a2cc4f506d
commit e2a34210e5
+4 -2
View File
@@ -20,8 +20,7 @@ from caelestia.utils.scheme import Scheme, get_scheme
from caelestia.utils.theme import apply_colours from caelestia.utils.theme import apply_colours
def is_valid_image(path: Path | str) -> bool: def is_valid_image(path: Path) -> bool:
path = Path(path)
return path.is_file() and path.suffix in [".jpg", ".jpeg", ".png", ".webp", ".tif", ".tiff"] 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: def set_wallpaper(wall: Path | str, no_smart: bool) -> None:
# Make path absolute
wall = Path(wall).resolve()
if not is_valid_image(wall): if not is_valid_image(wall):
raise ValueError(f'"{wall}" is not a valid image') raise ValueError(f'"{wall}" is not a valid image')