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:
2 files changed
+41
-12
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user