mirror of
https://github.com/swaywm/sway.git
synced 2026-02-28 01:41:02 -05:00
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']"`
This commit is contained in:
parent
a22d0c0ff6
commit
bf9a52bab0
3 changed files with 76 additions and 18 deletions
|
|
@ -13,6 +13,12 @@ _swaymsg_ [options...] [message]
|
|||
*-h, --help*
|
||||
Show help message and quit.
|
||||
|
||||
*-m, --monitor*
|
||||
Monitor for responses until killed instead of exiting after the first
|
||||
response. This can only be used with the IPC message type _subscribe_. If
|
||||
there is a malformed response or an invalid event type was requested,
|
||||
swaymsg will stop monitoring and exit.
|
||||
|
||||
*-q, --quiet*
|
||||
Sends the IPC message but does not print the response from sway.
|
||||
|
||||
|
|
@ -71,3 +77,8 @@ _swaymsg_ [options...] [message]
|
|||
|
||||
*send\_tick*
|
||||
Sends a tick event to all subscribed clients.
|
||||
|
||||
*subscribe*
|
||||
Subscribe to a list of event types. The argument for this type should be
|
||||
provided in the form of a valid JSON array. If any of the types are invalid
|
||||
or if an valid JSON array is not provided, this will result in an failure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue