]> git.sur5r.net Git - i3/i3.github.io/blobdiff - docs/ipc.html
Merge pull request #60 from sur5r/master
[i3/i3.github.io] / docs / ipc.html
index 34a55eaf82ac70a6b11b9509f6e6be4b59b23250..12d7fe831479039151dfd92a5004f60d9d4f6a91 100644 (file)
@@ -4,7 +4,7 @@
 <head>\r
 <link rel="icon" type="image/x-icon" href="/favicon.ico">\r
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.9" />\r
+<meta name="generator" content="AsciiDoc 8.6.10" />\r
 <title>i3: IPC interface (interprocess communication)</title>\r
 <link rel="stylesheet" href="/css/style.css" type="text/css" />\r
 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
@@ -171,6 +171,18 @@ cellspacing="0" cellpadding="4">
 <td align="center" valign="top"><p class="table"><a href="#_config_reply">CONFIG</a></p></td>\r
 <td align="center" valign="top"><p class="table">Returns the last loaded i3 config.</p></td>\r
 </tr>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">10</p></td>\r
+<td align="center" valign="top"><p class="table"><tt>SEND_TICK</tt></p></td>\r
+<td align="center" valign="top"><p class="table"><a href="#_tick_reply">TICK</a></p></td>\r
+<td align="center" valign="top"><p class="table">Sends a tick event with the specified payload.</p></td>\r
+</tr>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">11</p></td>\r
+<td align="center" valign="top"><p class="table"><tt>SYNC</tt></p></td>\r
+<td align="center" valign="top"><p class="table"><a href="#_sync_reply">SYNC</a></p></td>\r
+<td align="center" valign="top"><p class="table">Sends an i3 sync event with the specified random value to the specified window.</p></td>\r
+</tr>\r
 </tbody>\r
 </table>\r
 </div>\r
@@ -295,6 +307,14 @@ GET_CONFIG (9)
         Reply to the GET_CONFIG message.\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+TICK (10)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Reply to the SEND_TICK message.\r
+</p>\r
+</dd>\r
 </dl></div>\r
 </div>\r
 <div class="sect2">\r
@@ -642,6 +662,14 @@ window (integer)
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+window_properties (map)\r
+</dt>\r
+<dd>\r
+<p>\r
+        X11 window properties title, instance, class, window_role and transient_for.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 urgent (bool)\r
 </dt>\r
 <dd>\r
@@ -812,6 +840,12 @@ VGA1
             "width": 1280,\r
             "height": 782\r
           },\r
+          "window_properties": {\r
+            "class": "Evince",\r
+            "instance": "evince",\r
+            "title": "Properties",\r
+            "transient_for": 52428808\r
+          },\r
           "floating_nodes": [],\r
           "nodes": [\r
 \r
@@ -1186,6 +1220,30 @@ which is a string containing the config file as loaded by i3 most recently.</p><
 <pre><tt>{ "config": "font pango:monospace 8\nbindsym Mod4+q exit\n" }</tt></pre>\r
 </div></div>\r
 </div>\r
+<div class="sect2">\r
+<h3 id="_tick_reply">3.12. TICK reply</h3>\r
+<div class="paragraph"><p>The reply is a map containing the "success" member. After the reply was\r
+received, the tick event has been written to all IPC connections which subscribe\r
+to tick events. UNIX sockets are usually buffered, but you can be certain that\r
+once you receive the tick event you just triggered, you must have received all\r
+events generated prior to the <tt>SEND_TICK</tt> message (happened-before relation).</p></div>\r
+<div class="paragraph"><p><strong>Example:</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{ "success": true }</tt></pre>\r
+</div></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_sync_reply">3.13. SYNC reply</h3>\r
+<div class="paragraph"><p>The reply is a map containing the "success" member. After the reply was\r
+received, the <a href="https://i3wm.org/docs/testsuite.html#i3_sync">i3 sync message</a> was\r
+responded to.</p></div>\r
+<div class="paragraph"><p><strong>Example:</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{ "success": true }</tt></pre>\r
+</div></div>\r
+</div>\r
 </div>\r
 </div>\r
 <div class="sect1">\r
@@ -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\r
 event based library may not have a problem here), I suggest you create a\r
 separate connection to receive events.</p></div>\r
+<div class="paragraph"><p>If an event message needs to be sent and the socket is not writeable (write\r
+returns EAGAIN, happens when the socket doesn&#8217;t have enough buffer space for\r
+writing new data) then i3 uses a queue system to store outgoing messages for\r
+each client. This is combined with a timer: if the message queue for a client is\r
+not empty and no data where successfully written in the past 10 seconds, the\r
+connection is killed. Practically, this means that your client should try to\r
+always read events from the socket to avoid having its connection closed.</p></div>\r
 <div class="sect2">\r
 <h3 id="_subscribing_to_events">4.1. Subscribing to events</h3>\r
 <div class="paragraph"><p>By sending a message of type SUBSCRIBE with a JSON-encoded array as payload\r
@@ -1282,6 +1347,16 @@ shutdown (6)
         Sent when the ipc shuts down because of a restart or exit by user command\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+tick (7)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Sent when the ipc client subscribes to the tick event (with <tt>"first":\r
+        true</tt>) or when any ipc client sends a SEND_TICK message (with <tt>"first":\r
+        false</tt>).\r
+</p>\r
+</dd>\r
 </dl></div>\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
@@ -1520,6 +1595,27 @@ because of a user action such as a <tt>restart</tt> or <tt>exit</tt> command. Th
 }</tt></pre>\r
 </div></div>\r
 </div>\r
+<div class="sect2">\r
+<h3 id="_tick_event">4.10. tick event</h3>\r
+<div class="paragraph"><p>This event is triggered by a subscription to tick events or by a <tt>SEND_TICK</tt>\r
+message.</p></div>\r
+<div class="paragraph"><p><strong>Example (upon subscription):</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{\r
+ "first": true,\r
+ "payload": ""\r
+}</tt></pre>\r
+</div></div>\r
+<div class="paragraph"><p><strong>Example (upon <tt>SEND_TICK</tt> with a payload of <tt>arbitrary string</tt>):</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{\r
+ "first": false,\r
+ "payload": "arbitrary string"\r
+}</tt></pre>\r
+</div></div>\r
+</div>\r
 </div>\r
 </div>\r
 <div class="sect1">\r
@@ -1568,6 +1664,11 @@ Go
 <a href="https://github.com/mdirkse/i3ipc-go">https://github.com/mdirkse/i3ipc-go</a>\r
 </p>\r
 </li>\r
+<li>\r
+<p>\r
+<a href="https://github.com/i3/go-i3">https://github.com/i3/go-i3</a>\r
+</p>\r
+</li>\r
 </ul></div>\r
 </dd>\r
 <dt class="hdlist1">\r
@@ -1618,11 +1719,6 @@ Python
 </li>\r
 <li>\r
 <p>\r
-<a href="https://github.com/Ceryn/i3msg-python">https://github.com/Ceryn/i3msg-python</a>\r
-</p>\r
-</li>\r
-<li>\r
-<p>\r
 <a href="https://github.com/whitelynx/i3ipc">https://github.com/whitelynx/i3ipc</a> (not maintained)\r
 </p>\r
 </li>\r
@@ -1785,6 +1881,8 @@ From here on out, send/receive all messages using the detected byte order.
 </p>\r
 </li>\r
 </ol></div>\r
+<div class="paragraph"><p>Find an example implementation of this technique in\r
+<a href="https://github.com/i3/go-i3/blob/master/byteorder.go">https://github.com/i3/go-i3/blob/master/byteorder.go</a></p></div>\r
 </div>\r
 </div>\r
 </div>\r