diff options
| author | Batuhan Edgüer <67585935+BestSithInEU@users.noreply.github.com> | 2025-08-18 10:18:26 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-18 17:18:26 +1000 |
| commit | 3e19fd69199414eca2c1b6a77a688b1292588d48 (patch) | |
| tree | 219037a0328345af9df3c9ae98cee8e3524ddbb2 /src/caelestia/utils/theme.py | |
| parent | [CI] chore: update flake (diff) | |
| download | caelestia-cli-3e19fd69199414eca2c1b6a77a688b1292588d48.tar.gz caelestia-cli-3e19fd69199414eca2c1b6a77a688b1292588d48.tar.bz2 caelestia-cli-3e19fd69199414eca2c1b6a77a688b1292588d48.zip | |
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.
Diffstat (limited to 'src/caelestia/utils/theme.py')
| -rw-r--r-- | src/caelestia/utils/theme.py | 25 |
1 files changed, 24 insertions, 1 deletions
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) |