forge
Explore
Log in

Don't you dare go Hollow

wiki/IPC: Document --print-request and raw-request

Browse files at this commit

085f7f818cdc0434f7a7f1dd6b63a2488f466fa6Ivan MolodetskikhParent: a257b54
docs/wiki/IPC.mdmodified+11 -5
@@ -47,16 +47,22 @@ $ socat STDIO "$NIRI_SOCKET"
4747
4848 The reply is an `Ok` or an `Err` wrapping the same JSON object as you get from `niri msg --json`.
4949
50-For more complex requests, you can use `socat` to find how `niri msg` formats them:
50+<sup>Since: next release</sup>
51+For more complex requests, you can pass `--print-request` to `niri msg` to see how the request should be formatted:
5152
5253 ```sh
53-$ socat STDIO UNIX-LISTEN:temp.sock
54-# then, in a different terminal:
55-$ env NIRI_SOCKET=./temp.sock niri msg action focus-workspace 2
56-# then, look in the socat terminal:
54+$ niri msg --print-request action focus-workspace 2
5755 {"Action":{"FocusWorkspace":{"reference":{"Index":2}}}}
5856 ```
5957
58+This is the format that you should use for communicating with the niri socket directly.
59+You can also use `niri msg raw-request` to send a raw JSON request without `socat`:
60+
61+```sh
62+$ echo '{"Action":{"FocusWorkspace":{"reference":{"Id":8}}}}' | niri msg raw-request
63+"Handled"
64+```
65+
6066 You can find all available requests and response types in the [niri-ipc sub-crate documentation](https://niri-wm.github.io/niri/niri_ipc/).
6167
6268 ### Backwards Compatibility