Skip to content

hyprland/workspaces: old-style workspace dispatch fails on Hyprland Lua dispatcher builds #5008

@dwilliam62

Description

@dwilliam62

Summary

I am currently updating my project KoolDots to support the upcoming change in Hyprland to LUA based config files.

I had to change quite a few workspace movement functions to support LUA. In testing waybar I ran into this issue.
I did look to see if anyone else had filed it, but when i didn't see one I filed this.

Clicking numbered workspace buttons in hyprland/workspaces no longer switches to the clicked workspace on a Hyprland build where hyprctl dispatch is interpreted through the Lua dispatcher.

The workspace indicator reacts visually to the click, but Hyprland does not actually focus the clicked workspace.

Environment

  • Waybar: v0.15.0
  • Hyprland: 0.54.0
  • Hyprland commit: 9e357f2481fedfa75899d9721fe1cfc581b3bfc0
  • Waybar source checked at: cca8dc38
  • Module: hyprland/workspaces

Relevant config

"hyprland/workspaces#rw": {
  "disable-scroll": true,
  "all-outputs": true,
  "warp-on-scroll": false,
  "sort-by-number": true,
  "show-special": false,
  "on-scroll-up": "hyprctl dispatch 'hl.dsp.exec_raw(\"workspace e+1\")'",
  "on-scroll-down": "hyprctl dispatch 'hl.dsp.exec_raw(\"workspace e-1\")'",
  "persistent-workspaces": {
    "*": 5
  },
  "format": "{icon} {windows}",
  "format-window-separator": " ",
  "window-rewrite": {
    "...": "..."
  }
}

The active bar includes hyprland/workspaces#rw in modules-center.

Expected behavior

Clicking workspace 2, 3, etc. should focus that workspace.

Actual behavior

Clicking the workspace indicator changes its visual state, but the active Hyprland workspace does not change.

Manual dispatch testing

The old-style dispatcher form used by Waybar's Hyprland workspace click handler fails with this Hyprland build:

hyprctl dispatch workspace 2

Output:

[string "hl.dispatch(workspace 2)"]:1: ')' expected near '2'

 → Note: dispatch in lua is a shorthand for hl.dispatch(...), your syntax might need to be updated.

This command returns ok but does not move the active workspace:

hyprctl dispatch 'hl.dsp.exec_raw("workspace 2")'

This command successfully focuses workspace 2:

hyprctl dispatch 'hl.dsp.focus({ workspace = 2 })'

Observed active workspace changed from 1 1 to 2 2.

Source area that appears relevant

In src/modules/hyprland/workspace.cpp, Workspace::handleClicked(...) currently sends old-style dispatcher strings:

m_ipc.getSocket1Reply("dispatch workspace " + std::to_string(id()));

and with move-to-monitor:

m_ipc.getSocket1Reply("dispatch focusworkspaceoncurrentmonitor " + std::to_string(id()));

For named workspaces it sends:

m_ipc.getSocket1Reply("dispatch workspace name:" + name());

src/modules/hyprland/workspaces.cpp also appears to use old-style workspace dispatch strings in Workspaces::handleScroll(...):

m_ipc.getSocket1Reply("dispatch workspace e+1");
m_ipc.getSocket1Reply("dispatch workspace e-1");
m_ipc.getSocket1Reply("dispatch workspace m+1");
m_ipc.getSocket1Reply("dispatch workspace m-1");

Additional note

I initially had this in the module config:

"on-click": "activate",

Removing that line changed the visual click behavior: before removal, clicking a workspace number made the number disappear and left only an outline; after removal, the clicked workspace indicator lights up as selected. However, workspace focus still does not change, so the root cause appears to be the dispatcher syntax rather than only generic on-click handling.

Possible fix direction

For numeric workspace focus on this Hyprland Lua dispatcher build, the working form is:

dispatch hl.dsp.focus({ workspace = <id> })

Waybar may need to detect/support Hyprland Lua dispatcher syntax or avoid old-style dispatch workspace <id> calls when Hyprland expects Lua dispatch expressions.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions