Skip to content

fix(hyprland): use [[BATCH]] format for IPC dispatch commands#6

Open
RichardLeite wants to merge 1 commit into
Axenide:mainfrom
RichardLeite:main
Open

fix(hyprland): use [[BATCH]] format for IPC dispatch commands#6
RichardLeite wants to merge 1 commit into
Axenide:mainfrom
RichardLeite:main

Conversation

@RichardLeite

@RichardLeite RichardLeite commented Jun 17, 2026

Copy link
Copy Markdown

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 like j/clients, j/workspaces work fine, but commands prefixed with dispatch (e.g. dispatch workspace 2) are rejected with "Bad workspace" because they require the batch format ([[BATCH]]...).

hyprctl dispatch workspace 2 works because hyprctl internally wraps the command in [[BATCH]]dispatch workspace 2.

What was fixed

  1. dispatchVersioned() — prefix dispatch commands with [[BATCH]]
  2. dispatch() — expand error detection to catch "Bad workspace", "Invalid dispatcher", etc.
  3. supportsLuaDispatchers() — use hyprctl version instead of h.dispatch("j/version") (which returns unknown request on the IPC socket)
  4. Automatic fallback — try Lua dispatcher (hl.dsp.*) first; if rejected with "Invalid dispatcher", fall back to legacy dispatcher

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.
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.

1 participant