From b08858191cf6e3acda33afbd532b743ad6d0f808 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 11 Jun 2025 22:25:03 +1000 Subject: feat: theme btop Also change template replacement format --- src/caelestia/utils/theme.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/caelestia/utils/theme.py') diff --git a/src/caelestia/utils/theme.py b/src/caelestia/utils/theme.py index c4e9899..7f29637 100644 --- a/src/caelestia/utils/theme.py +++ b/src/caelestia/utils/theme.py @@ -19,10 +19,10 @@ def gen_scss(colours: dict[str, str]) -> str: return scss -def gen_replace(colours: dict[str, str], template: Path) -> str: +def gen_replace(colours: dict[str, str], template: Path, hash: bool = False) -> str: template = template.read_text() for name, colour in colours.items(): - template = template.replace(f"${name}", colour) + template = template.replace(f"{{{{ ${name} }}}}", f"#{colour}" if hash else colour) return template @@ -107,9 +107,16 @@ def apply_fuzzel(colours: dict[str, str]) -> None: try_write(config_dir / "fuzzel/fuzzel.ini", template) +def apply_btop(colours: dict[str, str]) -> None: + template = gen_replace(colours, templates_dir / "btop.theme", hash=True) + try_write(config_dir / "btop/themes/caelestia.theme", template) + subprocess.run(["killall", "-USR2", "btop"]) + + def apply_colours(colours: dict[str, str]) -> None: apply_terms(gen_sequences(colours)) apply_hypr(gen_conf(colours)) apply_discord(gen_scss(colours)) apply_spicetify(colours) apply_fuzzel(colours) + apply_btop(colours) -- cgit v1.2.3-freya