The new get_bindings IPC interface (IPC_GET_BINDINGS) allows swaymsg (and
other IPC clients) to interrogate sway's input bindings for all configured
binding modes.
The output of get_bindings is a JSON object mapping each configured binding
mode (e.g. "default", "resize", etc.) to an array of binding objects. The
binding JSON objects are of the same form as those in IPC_EVENT_BINDING.
N.B. a big chunk of code from ipc_event_binding() is moved to a new
ipc_json_describe_binding() function which services both the new
IPC_GET_BINDINGS as well as the existing IPC_EVENT_BINDING commands.
Signed-off-by: Peter Grayson <pete@jpgrayson.net>
This new option forces pretty (non-raw/non-JSON) output. By default, when
not using a tty, swaymsg outputs using the "raw" format. This makes it
impossible to, for example, pipe the pretty output to a pager such as
`less` since piping does not use a tty.
The new -p/--pretty option gives the user explicit control over the output
format while retaining the default tty-dependent behavior.
Signed-off-by: Peter Grayson <pete@jpgrayson.net>
This add `sway-ipc.7.scd` that documents the IPC protocol.
This also increased the minimum scdoc version from 1.8.1 to 1.9.0 to
allow for table cells to be continued on the following line
In `i3 4.16`, `i3-msg` can be used with the message type `subscribe`
and has the ability to monitor for responses until killed. This adds
support for both to swaymsg.
If the JSON array of event types is malformed or contains an invalid
event, sway will send a response with `success` set to `false`. If
swaymsg sees this, it will not display the failure and exit.
If the `subscribe` event is successful, swaymsg will wait for the first
response and display that instead of the success message. If
`-m/--monitor` is given, swaymsg will continue monitor for responses
until killed or a malformed response is received.
For the `subscribe` event, the responses will always be printed as JSON.
If `-r/--raw` is given, the JSON will not be pretty printed, which may
be preferred when monitoring due to there being multiple responses.
Example: `swaymsg -t SUBSCRIBE -m "['window']"`