i3-msg: add support for SUBSCRIBE message type
If i3-msg is invoked with -t subscribe, it will wait for the first event matching the given payload, before exiting. For instance, get the number of the next focused workspace with: i3-msg -t subscribe '[ "workspace" ]' | jshon -e current -e num Like inotifywait, the -m flag allows to wait indefinitely for events, instead of exiting right after receiving the first one. For example, continuously monitor the names of focused windows with: i3-msg -t subscribe -m '[ "window" ]' | jq .container.name
This commit is contained in:
@ -31,6 +31,11 @@ with an error.
|
||||
*-t* 'type'::
|
||||
Send ipc message, see below. This option defaults to "command".
|
||||
|
||||
*-m*, *--monitor*::
|
||||
Instead of exiting right after receiving the first subscribed event,
|
||||
wait indefinitely for all of them. Can only be used with "-t subscribe".
|
||||
See the "subscribe" IPC message type below for details.
|
||||
|
||||
*message*::
|
||||
Send ipc message, see below.
|
||||
|
||||
@ -75,6 +80,11 @@ Gets the currently loaded i3 configuration.
|
||||
send_tick::
|
||||
Sends a tick to all IPC connections which subscribe to tick events.
|
||||
|
||||
subscribe::
|
||||
The payload of the message describes the events to subscribe to.
|
||||
Upon reception, each event will be dumped as a JSON-encoded object.
|
||||
See the -m option for continuous monitoring.
|
||||
|
||||
== DESCRIPTION
|
||||
|
||||
i3-msg is a sample implementation for a client using the unix socket IPC
|
||||
@ -91,6 +101,9 @@ i3-msg border normal
|
||||
|
||||
# Dump the layout tree
|
||||
i3-msg -t get_tree
|
||||
|
||||
# Monitor window changes
|
||||
i3-msg -t subscribe -m '[ "window" ]'
|
||||
------------------------------------------------
|
||||
|
||||
== ENVIRONMENT
|
||||
|
Reference in New Issue
Block a user