summaryrefslogtreecommitdiff
path: root/src/caelestia/utils/paths.py
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-12 15:48:02 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-12 15:48:02 +1000
commit194826efaa95480bfe1799f889ca5c02571b3e36 (patch)
treea4dd4879f99d1087ef8d51ea328f48e9c578f397 /src/caelestia/utils/paths.py
parenttheme: better spicetify colours (diff)
downloadcaelestia-cli-194826efaa95480bfe1799f889ca5c02571b3e36.tar.gz
caelestia-cli-194826efaa95480bfe1799f889ca5c02571b3e36.tar.bz2
caelestia-cli-194826efaa95480bfe1799f889ca5c02571b3e36.zip
feat: generate dynamic schemes
Diffstat (limited to 'src/caelestia/utils/paths.py')
-rw-r--r--src/caelestia/utils/paths.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/caelestia/utils/paths.py b/src/caelestia/utils/paths.py
index dfb57d9..6a6e0a8 100644
--- a/src/caelestia/utils/paths.py
+++ b/src/caelestia/utils/paths.py
@@ -1,16 +1,33 @@
+import hashlib
import os
from pathlib import Path
config_dir = Path(os.getenv("XDG_CONFIG_HOME", Path.home() / ".config"))
data_dir = Path(os.getenv("XDG_DATA_HOME", Path.home() / ".local/share"))
state_dir = Path(os.getenv("XDG_STATE_HOME", Path.home() / ".local/state"))
+cache_dir = Path(os.getenv("XDG_CACHE_HOME", Path.home() / ".cache"))
c_config_dir = config_dir / "caelestia"
c_data_dir = data_dir / "caelestia"
c_state_dir = state_dir / "caelestia"
+c_cache_dir = cache_dir / "caelestia"
cli_data_dir = Path(__file__).parent.parent / "data"
templates_dir = cli_data_dir / "templates"
scheme_path = c_state_dir / "scheme.json"
-scheme_data_path = cli_data_dir / "schemes"
+scheme_data_dir = cli_data_dir / "schemes"
+scheme_cache_dir = c_cache_dir / "schemes"
+
+last_wallpaper_path = c_state_dir / "wallpaper/last.txt"
+wallpaper_thumbnail_path = c_state_dir / "wallpaper/thumbnail.jpg"
+
+
+def compute_hash(path: str) -> str:
+ sha = hashlib.sha256()
+
+ with open(path, "rb") as f:
+ while chunk := f.read(8192):
+ sha.update(chunk)
+
+ return sha.hexdigest()