From 3e19fd69199414eca2c1b6a77a688b1292588d48 Mon Sep 17 00:00:00 2001 From: Batuhan Edgüer <67585935+BestSithInEU@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:18:26 +0300 Subject: theme: add nvtop, htop, and cava support (#45) * templates: add nvtop, htop, and cava support * Triggers htop and cava theme reloads Sends a USR2 signal to htop and cava after their themes are applied. This prompts the applications to reload their configuration files, ensuring new themes are visible instantly without requiring a manual restart. --- src/caelestia/utils/theme.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/caelestia/utils/theme.py') diff --git a/src/caelestia/utils/theme.py b/src/caelestia/utils/theme.py index 43c19eb..b55dbbe 100644 --- a/src/caelestia/utils/theme.py +++ b/src/caelestia/utils/theme.py @@ -149,6 +149,17 @@ def apply_btop(colours: dict[str, str]) -> None: subprocess.run(["killall", "-USR2", "btop"], stderr=subprocess.DEVNULL) +def apply_nvtop(colours: dict[str, str]) -> None: + template = gen_replace(colours, templates_dir / "nvtop.colors", hash=True) + write_file(config_dir / "nvtop/nvtop.colors", template) + + +def apply_htop(colours: dict[str, str]) -> None: + template = gen_replace(colours, templates_dir / "htop.theme", hash=True) + write_file(config_dir / "htop/htoprc", template) + subprocess.run(["killall", "-USR2", "htop"], stderr=subprocess.DEVNULL) + + def apply_gtk(colours: dict[str, str], mode: str) -> None: template = gen_replace(colours, templates_dir / "gtk.css", hash=True) write_file(config_dir / "gtk-3.0/gtk.css", template) @@ -187,12 +198,18 @@ general="Sans Serif,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" def apply_warp(colours: dict[str, str], mode: str) -> None: warp_mode = "darker" if mode == "dark" else "lighter" - + template = gen_replace(colours, templates_dir / "warp.yaml", hash=True) template = template.replace("{{ $warp_mode }}", warp_mode) write_file(data_dir / "warp-terminal/themes/caelestia.yaml", template) +def apply_cava(colours: dict[str, str]) -> None: + template = gen_replace(colours, templates_dir / "cava.conf", hash=True) + write_file(config_dir / "cava/config", template) + subprocess.run(["killall", "-USR2", "cava"], stderr=subprocess.DEVNULL) + + def apply_user_templates(colours: dict[str, str]) -> None: if not user_templates_dir.is_dir(): return @@ -224,10 +241,16 @@ def apply_colours(colours: dict[str, str], mode: str) -> None: apply_fuzzel(colours) if check("enableBtop"): apply_btop(colours) + if check("enableNvtop"): + apply_nvtop(colours) + if check("enableHtop"): + apply_htop(colours) if check("enableGtk"): apply_gtk(colours, mode) if check("enableQt"): apply_qt(colours, mode) if check("enableWarp"): apply_warp(colours, mode) + if check("enableCava"): + apply_cava(colours) apply_user_templates(colours) -- cgit v1.2.3-freya