X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=docs%2Fipc.html;h=268e1405341efda25643ad502376660c0a19c267;hb=6c4bce4e72f0b8cf1aa9aa5fa625026831ed732a;hp=34a55eaf82ac70a6b11b9509f6e6be4b59b23250;hpb=4f2a4ac4dccfadd56bbc349e10289bf8750a0e67;p=i3%2Fi3.github.io diff --git a/docs/ipc.html b/docs/ipc.html index 34a55ea..268e140 100644 --- a/docs/ipc.html +++ b/docs/ipc.html @@ -4,7 +4,7 @@ - + i3: IPC interface (interprocess communication) @@ -33,9 +33,9 @@ document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); a Michael Stapelberg
<michael@i3wm.org>
September 2017 -
-
Table of Contents
- +
+
Table of Contents
+
@@ -171,6 +171,18 @@ cellspacing="0" cellpadding="4">

CONFIG

Returns the last loaded i3 config.

+ +

10

+

SEND_TICK

+

TICK

+

Sends a tick event with the specified payload.

+ + +

11

+

SYNC

+

SYNC

+

Sends an i3 sync event with the specified random value to the specified window.

+
@@ -295,6 +307,14 @@ GET_CONFIG (9) Reply to the GET_CONFIG message.

+
+TICK (10) +
+
+

+ Reply to the SEND_TICK message. +

+
@@ -642,6 +662,14 @@ window (integer)

+window_properties (map) +
+
+

+ X11 window properties title, instance, class, window_role and transient_for. +

+
+
urgent (bool)
@@ -812,6 +840,12 @@ VGA1 "width": 1280, "height": 782 }, + "window_properties": { + "class": "Evince", + "instance": "evince", + "title": "Properties", + "transient_for": 52428808 + }, "floating_nodes": [], "nodes": [ @@ -1186,6 +1220,30 @@ which is a string containing the config file as loaded by i3 most recently.

<
{ "config": "font pango:monospace 8\nbindsym Mod4+q exit\n" }
+
+

3.12. TICK reply

+

The reply is a map containing the "success" member. After the reply was +received, the tick event has been written to all IPC connections which subscribe +to tick events. UNIX sockets are usually buffered, but you can be certain that +once you receive the tick event you just triggered, you must have received all +events generated prior to the SEND_TICK message (happened-before relation).

+

Example:

+
+
+
{ "success": true }
+
+
+
+

3.13. SYNC reply

+

The reply is a map containing the "success" member. After the reply was +received, the i3 sync message was +responded to.

+

Example:

+
+
+
{ "success": true }
+
+
@@ -1203,6 +1261,13 @@ situation can happen: You send a GET_WORKSPACES request but you receive a program does not want to cope which such kinds of race conditions (an event based library may not have a problem here), I suggest you create a separate connection to receive events.

+

If an event message needs to be sent and the socket is not writeable (write +returns EAGAIN, happens when the socket doesn’t have enough buffer space for +writing new data) then i3 uses a queue system to store outgoing messages for +each client. This is combined with a timer: if the message queue for a client is +not empty and no data where successfully written in the past 10 seconds, the +connection is killed. Practically, this means that your client should try to +always read events from the socket to avoid having its connection closed.

4.1. Subscribing to events

By sending a message of type SUBSCRIBE with a JSON-encoded array as payload @@ -1282,6 +1347,16 @@ shutdown (6) Sent when the ipc shuts down because of a restart or exit by user command

+
+tick (7) +
+
+

+ Sent when the ipc client subscribes to the tick event (with "first": + true) or when any ipc client sends a SEND_TICK message (with "first": + false). +

+

Example:

@@ -1520,6 +1595,27 @@ because of a user action such as a restart or exit command. Th }
+
+

4.10. tick event

+

This event is triggered by a subscription to tick events or by a SEND_TICK +message.

+

Example (upon subscription):

+
+
+
{
+ "first": true,
+ "payload": ""
+}
+
+

Example (upon SEND_TICK with a payload of arbitrary string):

+
+
+
{
+ "first": false,
+ "payload": "arbitrary string"
+}
+
+
@@ -1568,6 +1664,11 @@ Go https://github.com/mdirkse/i3ipc-go

+
  • +

    +https://github.com/i3/go-i3 +

    +
  • @@ -1618,11 +1719,6 @@ Python
  • -https://github.com/Ceryn/i3msg-python -

    -
  • -
  • -

    https://github.com/whitelynx/i3ipc (not maintained)

  • @@ -1785,12 +1881,16 @@ From here on out, send/receive all messages using the detected byte order.

    +

    Find an example implementation of this technique in +https://github.com/i3/go-i3/blob/master/byteorder.go