Skip to content

fix(hyprland/workspaces): adapt dispatch commands for Lua IPC protocol#5013

Merged
Alexays merged 2 commits into
Alexays:masterfrom
higorprado:fix/hyprland-lua-dispatch-protocol
May 4, 2026
Merged

fix(hyprland/workspaces): adapt dispatch commands for Lua IPC protocol#5013
Alexays merged 2 commits into
Alexays:masterfrom
higorprado:fix/hyprland-lua-dispatch-protocol

Conversation

@higorprado
Copy link
Copy Markdown
Contributor

Hyprland 0.54 replaced the text-based dispatch socket protocol with a Lua-based one. Commands like "dispatch workspace 1" are now interpreted as invalid Lua (return hl.dispatch(workspace 1)), breaking workspace clicks and scroll navigation.

Add IPC::dispatch() that probes the running Hyprland on first call and routes commands through the new hl.dsp Lua API when the Lua protocol is detected, falling back to the old text format otherwise.

Affected dispatchers: workspace, focusworkspaceoncurrentmonitor, togglespecialworkspace

Hyprland 0.54 replaced the text-based dispatch socket protocol with a
Lua-based one. Commands like "dispatch workspace 1" are now interpreted
as invalid Lua (return hl.dispatch(workspace 1)), breaking workspace
clicks and scroll navigation.

Add IPC::dispatch() that probes the running Hyprland on first call and
routes commands through the new hl.dsp Lua API when the Lua protocol is
detected, falling back to the old text format otherwise.
Copy link
Copy Markdown
Contributor

@zjeffer zjeffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.cpp and windowcount.cpp will also need this fix

@higorprado
Copy link
Copy Markdown
Contributor Author

window.cpp and windowcount.cpp will also need this fix

@zjeffer thanks for the review! I've checked window.cpp and windowcount.cpp thoroughly — neither file has any getSocket1Reply("dispatch ...") calls. They only use getSocket1JsonReply() for queries like activeworkspace, clients, monitors, and workspaces. Could you clarify what specifically needs fixing there? Are the query calls (e.g., j/activeworkspace) also affected by the Lua protocol change, or is there something else I'm missing?

@zjeffer
Copy link
Copy Markdown
Contributor

zjeffer commented May 2, 2026

window.cpp and windowcount.cpp will also need this fix

@zjeffer thanks for the review! I've checked window.cpp and windowcount.cpp thoroughly — neither file has any getSocket1Reply("dispatch ...") calls. They only use getSocket1JsonReply() for queries like activeworkspace, clients, monitors, and workspaces. Could you clarify what specifically needs fixing there? Are the query calls (e.g., j/activeworkspace) also affected by the Lua protocol change, or is there something else I'm missing?

I misread, I thought they used getSocket1Reply. Nevermind.


I just noticed we have tests in test/hyprland/backend.cpp, can you add tests for the new backend functions (where possible)?

Move buildLuaDispatch and isLuaProtocol from private to
protected/public so IPCTestHelper can access them.

Add 7 tests covering all buildLuaDispatch branches, dispatch
error path, and isLuaProtocol cache behavior.
@higorprado
Copy link
Copy Markdown
Contributor Author

I just noticed we have tests in test/hyprland/backend.cpp, can you add tests for the new backend functions (where possible)?

@zjeffer done — added 7 unit tests for the new backend functions. Had to move buildLuaDispatch to public and isLuaProtocol + s_luaProtocolDetected_ to protected so IPCTestHelper could access them. Let me know if anything else needs changing.

@Alexays Alexays merged commit 0594574 into Alexays:master May 4, 2026
9 checks passed
@higorprado higorprado deleted the fix/hyprland-lua-dispatch-protocol branch May 4, 2026 23:00
@Akmadan23
Copy link
Copy Markdown

Hey @Alexays, since this fix is very important for hyprland users and addresses a breaking change, I was wondering if it would be possible to release v0.15.1, which would be really helpful. Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants