feat(src/window/panel/components): improve Hyprland command dispatch syntax and workspace navigation

Use quoted commands and explicit method calls to avoid shell parsing issues.
This commit is contained in:
sankalp committed 2026-06-16 22:24:56 +05:45
1 parent d887e22f0b
commit 2a81a27ace
2 files changed
+41 -12

No files matched your search

+21 -2
View File
@@ -8,6 +8,25 @@ from utils.utils import setup_cursor_hover
# TODO: Support multi-monitor setups
class LuaHyprlandWorkspaces(HyprlandWorkspaces):
def do_action_next(self):
ws = "e" if not self._empty_scroll else ""
return self.connection.send_command(
f"batch/dispatch hl.dsp.focus({{workspace=[[{ws}+1]]}})"
)
def do_action_previous(self):
ws = "e" if not self._empty_scroll else ""
return self.connection.send_command(
f"batch/dispatch hl.dsp.focus({{workspace=[[{ws}-1]]}})"
)
def do_button_clicked(self, button: WorkspaceButton):
return self.connection.send_command(
f"batch/dispatch hl.dsp.focus({{workspace=[[{button.id}]]}})"
)
class WorkspaceIndicator(Box):
def __init__(self, **kwargs):
Box.__init__(
@@ -16,7 +35,7 @@ class WorkspaceIndicator(Box):
self._current_config = {"hide_special_workspace": True}
on_config_change(self._on_config_changed)
self.workspaces = HyprlandWorkspaces(
self.workspaces = LuaHyprlandWorkspaces(
name="workspaces",
spacing=4,
buttons_factory=self._get_button_factory(),
@@ -72,7 +91,7 @@ class WorkspaceIndicator(Box):
if hasattr(self, "workspaces") and self.workspaces:
self.workspaces.destroy()
self.workspaces = HyprlandWorkspaces(
self.workspaces = LuaHyprlandWorkspaces(
name="workspaces",
spacing=4,
buttons_factory=button_factory,