Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/caelestia/subcommands/toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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)
22 changes: 18 additions & 4 deletions src/caelestia/utils/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"):
Expand Down