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"
47 47
48 The reply is an `Ok` or an `Err` wrapping the same JSON object as you get from `niri msg --json`.48 The reply is an `Ok` or an `Err` wrapping the same JSON object as you get from `niri msg --json`.
49 49
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:
51 52
52 ```sh53 ```sh
53-$ socat STDIO UNIX-LISTEN:temp.sock54+$ niri msg --print-request action focus-workspace 2
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:
57 {"Action":{"FocusWorkspace":{"reference":{"Index":2}}}}55 {"Action":{"FocusWorkspace":{"reference":{"Index":2}}}}
58 ```56 ```
59 57
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+
60 You can find all available requests and response types in the [niri-ipc sub-crate documentation](https://niri-wm.github.io/niri/niri_ipc/).66 You can find all available requests and response types in the [niri-ipc sub-crate documentation](https://niri-wm.github.io/niri/niri_ipc/).
61 67
62 ### Backwards Compatibility68 ### Backwards Compatibility