From 085f7f818cdc0434f7a7f1dd6b63a2488f466fa6 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 14 Sep 2026 14:54:12 +0300 Subject: [PATCH] wiki/IPC: Document --print-request and raw-request --- docs/wiki/IPC.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/wiki/IPC.md b/docs/wiki/IPC.md index 415ba2a6..f96061f6 100644 --- a/docs/wiki/IPC.md +++ b/docs/wiki/IPC.md @@ -47,16 +47,22 @@ $ socat STDIO "$NIRI_SOCKET" The reply is an `Ok` or an `Err` wrapping the same JSON object as you get from `niri msg --json`. -For more complex requests, you can use `socat` to find how `niri msg` formats them: +Since: next release +For more complex requests, you can pass `--print-request` to `niri msg` to see how the request should be formatted: ```sh -$ socat STDIO UNIX-LISTEN:temp.sock -# then, in a different terminal: -$ env NIRI_SOCKET=./temp.sock niri msg action focus-workspace 2 -# then, look in the socat terminal: +$ niri msg --print-request action focus-workspace 2 {"Action":{"FocusWorkspace":{"reference":{"Index":2}}}} ``` +This is the format that you should use for communicating with the niri socket directly. +You can also use `niri msg raw-request` to send a raw JSON request without `socat`: + +```sh +$ echo '{"Action":{"FocusWorkspace":{"reference":{"Id":8}}}}' | niri msg raw-request +"Handled" +``` + You can find all available requests and response types in the [niri-ipc sub-crate documentation](https://niri-wm.github.io/niri/niri_ipc/). ### Backwards Compatibility