diff --git a/src/caelestia/subcommands/toggle.py b/src/caelestia/subcommands/toggle.py index 56565f37..36172759 100644 --- a/src/caelestia/subcommands/toggle.py +++ b/src/caelestia/subcommands/toggle.py @@ -120,6 +120,7 @@ def run(self) -> None: if not spawned: hypr.dispatch("togglespecialworkspace", self.args.workspace) + hypr.dispatch(f'hl.dsp.workspace.toggle_special( "{self.args.workspace}" )') def get_clients(self) -> list[dict[str, Any]]: if self.clients is None: @@ -130,11 +131,13 @@ def move_client(self, selector: Callable, workspace: str) -> None: for client in self.get_clients(): if selector(client) and client["workspace"]["name"] != f"special:{workspace}": hypr.dispatch("movetoworkspacesilent", f"special:{workspace},address:{client['address']}") + hypr.dispatch(f'hl.dsp.window.move({{ workspace = "special:{workspace}" , follow = "address:{client['address']}"}}') def spawn_client(self, selector: Callable, spawn: list[str]) -> bool: if (spawn[0].endswith(".desktop") or shutil.which(spawn[0])) and not any( selector(client) for client in self.get_clients() ): + hypr.dispatch(f'hl.dsp.exec_cmd(" app2unit -- {shlex.join(spawn)} " ,{{ workspace = "special:{self.args.workspace}" }})') hypr.dispatch("exec", f"[workspace special:{self.args.workspace}] app2unit -- {shlex.join(spawn)}") return True else: @@ -161,4 +164,6 @@ def specialws(self) -> None: target = next((m for m in monitors if m.get("focused")), None) if target: special = target.get("specialWorkspace", {}).get("name", "")[8:] or "special" + + hypr.dispatch(f'hl.dsp.workspace.toggle_special( "{special}" )') hypr.dispatch("togglespecialworkspace", special) diff --git a/src/caelestia/utils/theme.py b/src/caelestia/utils/theme.py index 9fc95f4e..1482b1a6 100644 --- a/src/caelestia/utils/theme.py +++ b/src/caelestia/utils/theme.py @@ -21,13 +21,24 @@ from caelestia.utils.scheme import get_scheme +def gen_lua(colours: dict[str, str]) -> str: + # Start the Lua return statement + lua = "return {\n" + + for name, colour in colours.items(): + # Indent, add the key, and wrap the hex code in quotes + lua += f' {name} = "{colour}",\n' + + # Close the table + lua += "}" + return lua + def gen_conf(colours: dict[str, str]) -> str: conf = "" for name, colour in colours.items(): conf += f"${name} = {colour}\n" return conf - def gen_scss(colours: dict[str, str]) -> str: scss = "" for name, colour in colours.items(): @@ -143,9 +154,11 @@ def apply_terms(sequences: str) -> None: @log_exception -def apply_hypr(conf: str) -> None: - write_file(config_dir / "hypr/scheme/current.conf", conf) +def apply_hypr(lua: str) -> None: + write_file(config_dir / "hypr/scheme/current.lua", lua) +def apply_hyprlang(conf: str) -> None: + write_file(config_dir / "hypr/scheme/current.conf", conf) @log_exception def apply_discord(scss: str) -> None: @@ -428,7 +441,8 @@ def check(key: str) -> bool: if check("enableTerm"): apply_terms(gen_sequences(colours)) if check("enableHypr"): - apply_hypr(gen_conf(colours)) + apply_hypr(gen_lua(colours)) + apply_hyprlang(gen_conf(colours)) if check("enableDiscord"): apply_discord(gen_scss(colours)) if check("enableSpicetify"):