diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-18 17:34:11 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-18 17:34:11 +1000 |
| commit | 8903b1d1ab21368d60fd478eb8969c01ca2f7e9b (patch) | |
| tree | 12a0a7672637cb1a8bd4ba2ae90be4ef523e442c /src | |
| parent | shell: no duplicate + daemon option (diff) | |
| download | caelestia-cli-8903b1d1ab21368d60fd478eb8969c01ca2f7e9b.tar.gz caelestia-cli-8903b1d1ab21368d60fd478eb8969c01ca2f7e9b.tar.bz2 caelestia-cli-8903b1d1ab21368d60fd478eb8969c01ca2f7e9b.zip | |
scheme: handle no wallpaper dynamic scheme
Throw actually readable error and notify
Diffstat (limited to 'src')
| -rw-r--r-- | src/caelestia/utils/scheme.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/caelestia/utils/scheme.py b/src/caelestia/utils/scheme.py index ac52ea7..1e95376 100644 --- a/src/caelestia/utils/scheme.py +++ b/src/caelestia/utils/scheme.py @@ -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()) |