Commit Graph

10 Commits

Author SHA1 Message Date
Brian Ashworth
a8a239e2f1 swaymsg: return 2 for sway errors
This mirrors a change in i3 4.17 that returns 2 for errors from sway,
including invalid command, command failed, and invalid subscription
requests
2019-08-06 11:31:39 +09:00
Peter Grayson
b7fe5097e9 Add -p/--pretty option to swaymsg
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>
2019-03-08 14:29:39 -05:00
Brian Ashworth
f876009c7f Add sway-ipc.7.scd to document IPC protocol
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
2019-02-27 13:23:10 -05:00
Brian Ashworth
bf9a52bab0 Implement support for swaymsg -t SUBSCRIBE [-m]
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']"`
2018-11-28 11:19:18 -05:00
madblobfish
e47b31c556 document swaymessage type for get_seats 2018-11-04 22:49:44 +01:00
Ian Fan
3edaf2ce2a ipc: add tick event 2018-08-01 16:57:15 +01:00
emersion
ba3511b243 Remove clipboard command and get_clipboard message 2018-07-10 22:09:21 +01:00
Ian Fan
23c1c26c3f Add get_config message type to ipc 2018-07-10 12:37:37 +01:00
Ian Fan
5fd36164a0 Add get_binding_modes message type to ipc 2018-07-10 12:03:46 +01:00
Drew DeVault
22f52b91ed Add swaylock(1) and swaymsg(1) 2018-05-11 21:39:47 -04:00