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

+20 -10
View File
@@ -163,7 +163,7 @@ class GlobalMenuDropdowns:
[
dropdown_option(
"Enter Full Screen",
on_click="hyprctl dispatch fullscreen",
on_click="hyprctl dispatch 'hl.dsp.fullscreen()'",
),
],
)
@@ -184,25 +184,35 @@ class GlobalMenuDropdowns:
dropdown_divider("---------------------"),
dropdown_option(
"Move Window to Left",
on_click="hyprctl dispatch movewindow l",
on_click="hyprctl dispatch 'hl.dsp.movewindow([[l]])'",
),
dropdown_option(
"Move Window to Right",
on_click="hyprctl dispatch movewindow r",
on_click="hyprctl dispatch 'hl.dsp.movewindow([[r]])'",
),
dropdown_option(
"Cycle Through Windows",
on_click="hyprctl dispatch cyclenext",
on_click="hyprctl dispatch 'hl.dsp.cyclenext()'",
),
dropdown_divider("---------------------"),
dropdown_option("Float", on_click="hyprctl dispatch togglefloating"),
dropdown_option("Quit", on_click="hyprctl dispatch killactive"),
dropdown_option("Pseudo", on_click="hyprctl dispatch pseudo"),
dropdown_option(
"Toggle Split", on_click="hyprctl dispatch togglesplit"
"Float", on_click="hyprctl dispatch 'hl.dsp.togglefloating()'"
),
dropdown_option(
"Quit", on_click="hyprctl dispatch 'hl.dsp.killactive()'"
),
dropdown_option(
"Pseudo", on_click="hyprctl dispatch 'hl.dsp.pseudo()'"
),
dropdown_option(
"Toggle Split", on_click="hyprctl dispatch 'hl.dsp.togglesplit()'"
),
dropdown_option(
"Center", on_click="hyprctl dispatch 'hl.dsp.centerwindow()'"
),
dropdown_option(
"Group", on_click="hyprctl dispatch 'hl.dsp.togglegroup()'"
),
dropdown_option("Center", on_click="hyprctl dispatch centerwindow"),
dropdown_option("Group", on_click="hyprctl dispatch togglegroup"),
dropdown_option(
"Pin",
on_clicked=lambda _: exec_shell_command_async(
+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,