scheme: handle no wallpaper dynamic scheme

Throw actually readable error and notify
This commit is contained in:
2 * r + 2 * t
2025-06-18 17:34:11 +10:00
parent 83148d9351
commit 8903b1d1ab
+13 -1
View File
@@ -157,7 +157,19 @@ class Scheme:
def _update_colours(self) -> None:
if self.name == "dynamic":
self._colours = get_colours_for_image()
try:
self._colours = get_colours_for_image()
except FileNotFoundError:
if self.notify:
notify(
"-u",
"critical",
"Unable to set dynamic scheme",
"No wallpaper set. Please set a wallpaper via `caelestia wallpaper` before setting a dynamic scheme.",
)
raise ValueError(
"No wallpaper set. Please set a wallpaper via `caelestia wallpaper` before setting a dynamic scheme."
)
else:
self._colours = read_colours_from_file(self.get_colours_path())