refactor: add get_config func

This commit is contained in:
2 * r + 2 * t
2026-06-13 02:25:09 +10:00
parent d7b65b5946
commit 002a9c287f
6 changed files with 40 additions and 37 deletions
+2 -5
View File
@@ -15,9 +15,9 @@ from caelestia.utils.paths import (
c_state_dir,
config_dir,
data_dir,
get_config,
templates_dir,
theme_dir,
user_config_path,
user_templates_dir,
)
from caelestia.utils.scheme import get_scheme
@@ -417,10 +417,7 @@ def apply_colours(colours: dict[str, str], mode: str) -> None:
except BlockingIOError:
return
try:
cfg = json.loads(user_config_path.read_text())["theme"]
except (FileNotFoundError, json.JSONDecodeError, KeyError):
cfg = {}
cfg = get_config().get("theme", {})
def check(key: str) -> bool:
return cfg[key] if key in cfg else True