forked from Shinonome/caelestia-cli
theme: add config for progs to theme
This commit is contained in:
@@ -15,6 +15,7 @@ c_data_dir = data_dir / "caelestia"
|
|||||||
c_state_dir = state_dir / "caelestia"
|
c_state_dir = state_dir / "caelestia"
|
||||||
c_cache_dir = cache_dir / "caelestia"
|
c_cache_dir = cache_dir / "caelestia"
|
||||||
|
|
||||||
|
user_config_path = c_config_dir / "cli.json"
|
||||||
cli_data_dir = Path(__file__).parent.parent / "data"
|
cli_data_dir = Path(__file__).parent.parent / "data"
|
||||||
templates_dir = cli_data_dir / "templates"
|
templates_dir = cli_data_dir / "templates"
|
||||||
user_templates_dir = c_config_dir / "templates"
|
user_templates_dir = c_config_dir / "templates"
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from caelestia.utils.colour import get_dynamic_colours
|
from caelestia.utils.colour import get_dynamic_colours
|
||||||
from caelestia.utils.paths import c_state_dir, config_dir, templates_dir, theme_dir, user_templates_dir
|
from caelestia.utils.paths import (
|
||||||
|
c_state_dir,
|
||||||
|
config_dir,
|
||||||
|
templates_dir,
|
||||||
|
theme_dir,
|
||||||
|
user_config_path,
|
||||||
|
user_templates_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def gen_conf(colours: dict[str, str]) -> str:
|
def gen_conf(colours: dict[str, str]) -> str:
|
||||||
@@ -174,12 +182,28 @@ def apply_user_templates(colours: dict[str, str]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def apply_colours(colours: dict[str, str], mode: str) -> None:
|
def apply_colours(colours: dict[str, str], mode: str) -> None:
|
||||||
apply_terms(gen_sequences(colours))
|
try:
|
||||||
apply_hypr(gen_conf(colours))
|
cfg = json.loads(user_config_path.read_text())["theme"]
|
||||||
apply_discord(gen_scss(colours))
|
except (FileNotFoundError, json.JSONDecodeError, KeyError):
|
||||||
apply_spicetify(colours, mode)
|
cfg = {}
|
||||||
apply_fuzzel(colours)
|
|
||||||
apply_btop(colours)
|
def check(key: str) -> bool:
|
||||||
apply_gtk(colours, mode)
|
return cfg[key] if key in cfg else True
|
||||||
apply_qt(colours, mode)
|
|
||||||
|
if check("enableTerm"):
|
||||||
|
apply_terms(gen_sequences(colours))
|
||||||
|
if check("enableHypr"):
|
||||||
|
apply_hypr(gen_conf(colours))
|
||||||
|
if check("enableDiscord"):
|
||||||
|
apply_discord(gen_scss(colours))
|
||||||
|
if check("enableSpicetify"):
|
||||||
|
apply_spicetify(colours, mode)
|
||||||
|
if check("enableFuzzel"):
|
||||||
|
apply_fuzzel(colours)
|
||||||
|
if check("enableBtop"):
|
||||||
|
apply_btop(colours)
|
||||||
|
if check("enableGtk"):
|
||||||
|
apply_gtk(colours, mode)
|
||||||
|
if check("enableQt"):
|
||||||
|
apply_qt(colours, mode)
|
||||||
apply_user_templates(colours)
|
apply_user_templates(colours)
|
||||||
|
|||||||
Reference in New Issue
Block a user