fix(hyprland): use [[BATCH]] format for IPC dispatch commands#6
Open
RichardLeite wants to merge 1 commit into
Open
fix(hyprland): use [[BATCH]] format for IPC dispatch commands#6RichardLeite wants to merge 1 commit into
RichardLeite wants to merge 1 commit into
Conversation
Hyprland's IPC socket rejects plain dispatch commands with 'Bad workspace' or 'Invalid dispatcher'. Wrap them in the [[BATCH]] format that hyprctl uses internally, which is required for dispatch commands. Also improve dispatch() error detection to catch 'Bad workspace', 'Invalid dispatcher', and other known error responses. Fix version detection to use hyprctl binary instead of IPC socket (which does not support j/version). Add automatic fallback: if hl.dsp.* Lua dispatcher is rejected, fall back to legacy dispatcher.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
axctl workspace switch <id>returns{"result":"ok"}but the workspace never actually changes. This affects ambxst (and any other client) that relies on axctl for workspace navigation on Hyprland.Root Cause
h.dispatch()sends commands directly to Hyprland's IPC socket (.socket.sock) as plain text. Commands likej/clients,j/workspaceswork fine, but commands prefixed withdispatch(e.g.dispatch workspace 2) are rejected with"Bad workspace"because they require the batch format ([[BATCH]]...).hyprctl dispatch workspace 2works because hyprctl internally wraps the command in[[BATCH]]dispatch workspace 2.What was fixed
dispatchVersioned()— prefix dispatch commands with[[BATCH]]dispatch()— expand error detection to catch"Bad workspace","Invalid dispatcher", etc.supportsLuaDispatchers()— usehyprctl versioninstead ofh.dispatch("j/version")(which returnsunknown requeston the IPC socket)hl.dsp.*) first; if rejected with"Invalid dispatcher", fall back to legacy dispatcher