mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-05 14:59:29 -05:00
feat: add theme postHook
This commit is contained in:
@@ -208,7 +208,8 @@ All configuration options are in `~/.config/caelestia/cli.json`.
|
|||||||
"enableWarp": true,
|
"enableWarp": true,
|
||||||
"enableChromium": true,
|
"enableChromium": true,
|
||||||
"enableZed": true,
|
"enableZed": true,
|
||||||
"enableCava": true
|
"enableCava": true,
|
||||||
|
"postHook": "echo $SCHEME_NAME $SCHEME_FLAVOUR $SCHEME_MODE $SCHEME_VARIANT $SCHEME_COLOURS"
|
||||||
},
|
},
|
||||||
"toggles": {
|
"toggles": {
|
||||||
"communication": {
|
"communication": {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import fcntl
|
import fcntl
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -17,6 +18,7 @@ from caelestia.utils.paths import (
|
|||||||
user_config_path,
|
user_config_path,
|
||||||
user_templates_dir,
|
user_templates_dir,
|
||||||
)
|
)
|
||||||
|
from caelestia.utils.scheme import get_scheme
|
||||||
|
|
||||||
|
|
||||||
def gen_conf(colours: dict[str, str]) -> str:
|
def gen_conf(colours: dict[str, str]) -> str:
|
||||||
@@ -456,6 +458,22 @@ def apply_colours(colours: dict[str, str], mode: str) -> None:
|
|||||||
apply_cava(colours)
|
apply_cava(colours)
|
||||||
apply_user_templates(colours, mode)
|
apply_user_templates(colours, mode)
|
||||||
|
|
||||||
|
if post_hook := cfg.get("postHook"):
|
||||||
|
scheme = get_scheme()
|
||||||
|
subprocess.run(
|
||||||
|
post_hook,
|
||||||
|
shell=True,
|
||||||
|
env={
|
||||||
|
**os.environ,
|
||||||
|
"SCHEME_NAME": scheme.name,
|
||||||
|
"SCHEME_FLAVOUR": scheme.flavour,
|
||||||
|
"SCHEME_MODE": scheme.mode,
|
||||||
|
"SCHEME_VARIANT": scheme.variant,
|
||||||
|
"SCHEME_COLOURS": json.dumps(scheme.colours),
|
||||||
|
},
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
lock_file.unlink()
|
lock_file.unlink()
|
||||||
|
|||||||
Reference in New Issue
Block a user