1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
\r
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
\r
5 <link rel="icon" type="image/x-icon" href="/favicon.ico">
\r
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
\r
7 <meta name="generator" content="AsciiDoc 8.6.9" />
\r
8 <title>i3: IPC interface (interprocess communication)</title>
\r
9 <link rel="stylesheet" href="/css/style.css" type="text/css" />
\r
10 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />
\r
11 <script type="text/javascript">
\r
13 document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); asciidoc.toc(2);}, false);
\r
16 <script type="text/javascript" src="/js/asciidoc-xhtml11.js"></script>
\r
18 <body class="article">
\r
21 <a href="/"><h1 id="title">i3 - improved tiling WM</h1></a>
\r
23 <li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>
\r
24 <li><a href="/screenshots">Screens</a></li>
\r
25 <li><a href="https://www.reddit.com/r/i3wm/">FAQ</a></li>
\r
26 <li><a href="/contact">Contact</a></li>
\r
27 <li><a href="https://github.com/i3/i3/issues">Bugs</a></li>
\r
29 <br style="clear: both">
\r
32 <h1>IPC interface (interprocess communication)</h1>
\r
33 <span id="author">Michael Stapelberg</span><br />
\r
34 <span id="email"><tt><<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>></tt></span><br />
\r
35 <span id="revdate">September 2017</span>
\r
37 <div id="toctitle">Table of Contents</div>
38 <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
42 <div class="sectionbody">
\r
43 <div class="paragraph"><p>This document describes how to interface with i3 from a separate process. This
\r
44 is useful for example to remote-control i3 (to write test cases for example) or
\r
45 to get various information like the current workspaces to implement an external
\r
46 workspace bar.</p></div>
\r
47 <div class="paragraph"><p>The method of choice for IPC in our case is a unix socket because it has very
\r
48 little overhead on both sides and is usually available without headaches in
\r
49 most languages. In the default configuration file, the ipc-socket gets created
\r
50 in <tt>/tmp/i3-%u.XXXXXX/ipc-socket.%p</tt> where <tt>%u</tt> is your UNIX username, <tt>%p</tt> is
\r
51 the PID of i3 and XXXXXX is a string of random characters from the portable
\r
52 filename character set (see mkdtemp(3)). You can get the socketpath from i3 by
\r
53 calling <tt>i3 --get-socketpath</tt>.</p></div>
\r
54 <div class="paragraph"><p>All i3 utilities, like <tt>i3-msg</tt> and <tt>i3-input</tt> will read the <tt>I3_SOCKET_PATH</tt>
\r
55 X11 property, stored on the X11 root window.</p></div>
\r
56 <div class="admonitionblock">
\r
59 <div class="title">Warning</div>
\r
61 <td class="content">
\r
62 <div class="title">Use an existing library!</div>There are existing libraries for many languages. You can have a look at
\r
63 <a href="#libraries">[libraries]</a> or search the web if your language of choice is not mentioned.
\r
64 Usually, it is not necessary to implement low-level communication with i3
\r
71 <h2 id="_establishing_a_connection">1. Establishing a connection</h2>
\r
72 <div class="sectionbody">
\r
73 <div class="paragraph"><p>To establish a connection, simply open the IPC socket. The following code
\r
74 snippet illustrates this in Perl:</p></div>
\r
75 <div class="listingblock">
\r
76 <div class="content">
\r
77 <pre><tt>use IO::Socket::UNIX;
\r
78 chomp(my $path = qx(i3 --get-socketpath));
\r
79 my $sock = IO::Socket::UNIX->new(Peer => $path);</tt></pre>
\r
84 <h2 id="_sending_messages_to_i3">2. Sending messages to i3</h2>
\r
85 <div class="sectionbody">
\r
86 <div class="paragraph"><p>To send a message to i3, you have to format in the binary message format which
\r
87 i3 expects. This format specifies a magic string in the beginning to ensure
\r
88 the integrity of messages (to prevent follow-up errors). Following the magic
\r
89 string comes the length of the payload of the message as 32-bit integer, and
\r
90 the type of the message as 32-bit integer (the integers are not converted, so
\r
91 they are in native byte order).</p></div>
\r
92 <div class="paragraph"><p>The magic string currently is "i3-ipc" and will only be changed when a change
\r
93 in the IPC API is done which breaks compatibility (we hope that we don’t need
\r
94 to do that).</p></div>
\r
95 <div class="tableblock">
\r
99 cellspacing="0" cellpadding="4">
\r
100 <caption class="title">Table 1. Currently implemented message types</caption>
\r
101 <col width="10%" />
\r
102 <col width="20%" />
\r
103 <col width="20%" />
\r
104 <col width="50%" />
\r
107 <th align="center" valign="top"> Type (numeric) </th>
\r
108 <th align="center" valign="top"> Type (name) </th>
\r
109 <th align="center" valign="top"> Reply type </th>
\r
110 <th align="center" valign="top"> Purpose</th>
\r
115 <td align="center" valign="top"><p class="table">0</p></td>
\r
116 <td align="center" valign="top"><p class="table"><tt>RUN_COMMAND</tt></p></td>
\r
117 <td align="center" valign="top"><p class="table"><a href="#_command_reply">COMMAND</a></p></td>
\r
118 <td align="center" valign="top"><p class="table">Run the payload as an i3 command (like the commands you can bind to keys).</p></td>
\r
121 <td align="center" valign="top"><p class="table">1</p></td>
\r
122 <td align="center" valign="top"><p class="table"><tt>GET_WORKSPACES</tt></p></td>
\r
123 <td align="center" valign="top"><p class="table"><a href="#_workspaces_reply">WORKSPACES</a></p></td>
\r
124 <td align="center" valign="top"><p class="table">Get the list of current workspaces.</p></td>
\r
127 <td align="center" valign="top"><p class="table">2</p></td>
\r
128 <td align="center" valign="top"><p class="table"><tt>SUBSCRIBE</tt></p></td>
\r
129 <td align="center" valign="top"><p class="table"><a href="#_subscribe_reply">SUBSCRIBE</a></p></td>
\r
130 <td align="center" valign="top"><p class="table">Subscribe this IPC connection to the event types specified in the message payload. See <a href="#events">[events]</a>.</p></td>
\r
133 <td align="center" valign="top"><p class="table">3</p></td>
\r
134 <td align="center" valign="top"><p class="table"><tt>GET_OUTPUTS</tt></p></td>
\r
135 <td align="center" valign="top"><p class="table"><a href="#_outputs_reply">OUTPUTS</a></p></td>
\r
136 <td align="center" valign="top"><p class="table">Get the list of current outputs.</p></td>
\r
139 <td align="center" valign="top"><p class="table">4</p></td>
\r
140 <td align="center" valign="top"><p class="table"><tt>GET_TREE</tt></p></td>
\r
141 <td align="center" valign="top"><p class="table"><a href="#_tree_reply">TREE</a></p></td>
\r
142 <td align="center" valign="top"><p class="table">Get the i3 layout tree.</p></td>
\r
145 <td align="center" valign="top"><p class="table">5</p></td>
\r
146 <td align="center" valign="top"><p class="table"><tt>GET_MARKS</tt></p></td>
\r
147 <td align="center" valign="top"><p class="table"><a href="#_marks_reply">MARKS</a></p></td>
\r
148 <td align="center" valign="top"><p class="table">Gets the names of all currently set marks.</p></td>
\r
151 <td align="center" valign="top"><p class="table">6</p></td>
\r
152 <td align="center" valign="top"><p class="table"><tt>GET_BAR_CONFIG</tt></p></td>
\r
153 <td align="center" valign="top"><p class="table"><a href="#_bar_config_reply">BAR_CONFIG</a></p></td>
\r
154 <td align="center" valign="top"><p class="table">Gets the specified bar configuration or the names of all bar configurations if payload is empty.</p></td>
\r
157 <td align="center" valign="top"><p class="table">7</p></td>
\r
158 <td align="center" valign="top"><p class="table"><tt>GET_VERSION</tt></p></td>
\r
159 <td align="center" valign="top"><p class="table"><a href="#_version_reply">VERSION</a></p></td>
\r
160 <td align="center" valign="top"><p class="table">Gets the i3 version.</p></td>
\r
163 <td align="center" valign="top"><p class="table">8</p></td>
\r
164 <td align="center" valign="top"><p class="table"><tt>GET_BINDING_MODES</tt></p></td>
\r
165 <td align="center" valign="top"><p class="table"><a href="#_binding_modes_reply">BINDING_MODES</a></p></td>
\r
166 <td align="center" valign="top"><p class="table">Gets the names of all currently configured binding modes.</p></td>
\r
169 <td align="center" valign="top"><p class="table">9</p></td>
\r
170 <td align="center" valign="top"><p class="table"><tt>GET_CONFIG</tt></p></td>
\r
171 <td align="center" valign="top"><p class="table"><a href="#_config_reply">CONFIG</a></p></td>
\r
172 <td align="center" valign="top"><p class="table">Returns the last loaded i3 config.</p></td>
\r
175 <td align="center" valign="top"><p class="table">10</p></td>
\r
176 <td align="center" valign="top"><p class="table"><tt>SEND_TICK</tt></p></td>
\r
177 <td align="center" valign="top"><p class="table"><a href="#_tick_reply">TICK</a></p></td>
\r
178 <td align="center" valign="top"><p class="table">Sends a tick event with the specified payload.</p></td>
\r
183 <div class="paragraph"><p>So, a typical message could look like this:</p></div>
\r
184 <div class="listingblock">
\r
185 <div class="content">
\r
186 <pre><tt>"i3-ipc" <message length> <message type> <payload></tt></pre>
\r
188 <div class="paragraph"><p>Or, as a hexdump:</p></div>
\r
189 <div class="listingblock">
\r
190 <div class="content">
\r
191 <pre><tt>00000000 69 33 2d 69 70 63 04 00 00 00 00 00 00 00 65 78 |i3-ipc........ex|
\r
192 00000010 69 74 |it|</tt></pre>
\r
194 <div class="paragraph"><p>To generate and send such a message, you could use the following code in Perl:</p></div>
\r
195 <div class="listingblock">
\r
196 <div class="content">
\r
197 <pre><tt>sub format_ipc_command {
\r
200 # Get the real byte count (vs. amount of characters)
\r
201 { use bytes; $len = length($msg); }
\r
202 return "i3-ipc" . pack("LL", $len, 0) . $msg;
\r
205 $sock->write(format_ipc_command("exit"));</tt></pre>
\r
209 <div class="sect1">
\r
210 <h2 id="_receiving_replies_from_i3">3. Receiving replies from i3</h2>
\r
211 <div class="sectionbody">
\r
212 <div class="paragraph"><p>Replies from i3 usually consist of a simple string (the length of the string
\r
213 is the message_length, so you can consider them length-prefixed) which in turn
\r
214 contain the JSON serialization of a data structure. For example, the
\r
215 GET_WORKSPACES message returns an array of workspaces (each workspace is a map
\r
216 with certain attributes).</p></div>
\r
217 <div class="sect2">
\r
218 <h3 id="_reply_format">3.1. Reply format</h3>
\r
219 <div class="paragraph"><p>The reply format is identical to the normal message format. There also is
\r
220 the magic string, then the message length, then the message type and the
\r
222 <div class="paragraph"><p>The following reply types are implemented:</p></div>
\r
223 <div class="dlist"><dl>
\r
224 <dt class="hdlist1">
\r
229 Confirmation/Error code for the RUN_COMMAND message.
\r
232 <dt class="hdlist1">
\r
237 Reply to the GET_WORKSPACES message.
\r
240 <dt class="hdlist1">
\r
245 Confirmation/Error code for the SUBSCRIBE message.
\r
248 <dt class="hdlist1">
\r
253 Reply to the GET_OUTPUTS message.
\r
256 <dt class="hdlist1">
\r
261 Reply to the GET_TREE message.
\r
264 <dt class="hdlist1">
\r
269 Reply to the GET_MARKS message.
\r
272 <dt class="hdlist1">
\r
277 Reply to the GET_BAR_CONFIG message.
\r
280 <dt class="hdlist1">
\r
285 Reply to the GET_VERSION message.
\r
288 <dt class="hdlist1">
\r
293 Reply to the GET_BINDING_MODES message.
\r
296 <dt class="hdlist1">
\r
301 Reply to the GET_CONFIG message.
\r
304 <dt class="hdlist1">
\r
309 Reply to the SEND_TICK message.
\r
314 <div class="sect2">
\r
315 <h3 id="_command_reply">3.2. COMMAND reply</h3>
\r
316 <div class="paragraph"><p>The reply consists of a list of serialized maps for each command that was
\r
317 parsed. Each has the property <tt>success (bool)</tt> and may also include a
\r
318 human-readable error message in the property <tt>error (string)</tt>.</p></div>
\r
319 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
320 <div class="listingblock">
\r
321 <div class="content">
\r
322 <pre><tt>[{ "success": true }]</tt></pre>
\r
325 <div class="sect2">
\r
326 <h3 id="_workspaces_reply">3.3. WORKSPACES reply</h3>
\r
327 <div class="paragraph"><p>The reply consists of a serialized list of workspaces. Each workspace has the
\r
328 following properties:</p></div>
\r
329 <div class="dlist"><dl>
\r
330 <dt class="hdlist1">
\r
335 The logical number of the workspace. Corresponds to the command
\r
336 to switch to this workspace. For named workspaces, this will be -1.
\r
339 <dt class="hdlist1">
\r
344 The name of this workspace (by default num+1), as changed by the
\r
345 user. Encoded in UTF-8.
\r
348 <dt class="hdlist1">
\r
353 Whether this workspace is currently visible on an output (multiple
\r
354 workspaces can be visible at the same time).
\r
357 <dt class="hdlist1">
\r
362 Whether this workspace currently has the focus (only one workspace
\r
363 can have the focus at the same time).
\r
366 <dt class="hdlist1">
\r
371 Whether a window on this workspace has the "urgent" flag set.
\r
374 <dt class="hdlist1">
\r
379 The rectangle of this workspace (equals the rect of the output it
\r
380 is on), consists of x, y, width, height.
\r
383 <dt class="hdlist1">
\r
388 The video output this workspace is on (LVDS1, VGA1, …).
\r
392 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
393 <div class="listingblock">
\r
394 <div class="content">
\r
427 <div class="sect2">
\r
428 <h3 id="_subscribe_reply">3.4. SUBSCRIBE reply</h3>
\r
429 <div class="paragraph"><p>The reply consists of a single serialized map. The only property is
\r
430 <tt>success (bool)</tt>, indicating whether the subscription was successful (the
\r
431 default) or whether a JSON parse error occurred.</p></div>
\r
432 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
433 <div class="listingblock">
\r
434 <div class="content">
\r
435 <pre><tt>{ "success": true }</tt></pre>
\r
438 <div class="sect2">
\r
439 <h3 id="_outputs_reply">3.5. OUTPUTS reply</h3>
\r
440 <div class="paragraph"><p>The reply consists of a serialized list of outputs. Each output has the
\r
441 following properties:</p></div>
\r
442 <div class="dlist"><dl>
\r
443 <dt class="hdlist1">
\r
448 The name of this output (as seen in <tt>xrandr(1)</tt>). Encoded in UTF-8.
\r
451 <dt class="hdlist1">
\r
456 Whether this output is currently active (has a valid mode).
\r
459 <dt class="hdlist1">
\r
464 Whether this output is currently the primary output.
\r
467 <dt class="hdlist1">
\r
468 current_workspace (string)
\r
472 The name of the current workspace that is visible on this output. <tt>null</tt> if
\r
473 the output is not active.
\r
476 <dt class="hdlist1">
\r
481 The rectangle of this output (equals the rect of the output it
\r
482 is on), consists of x, y, width, height.
\r
486 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
487 <div class="listingblock">
\r
488 <div class="content">
\r
493 "current_workspace": "4",
\r
504 "current_workspace": "1",
\r
515 <div class="sect2">
\r
516 <h3 id="_tree_reply">3.6. TREE reply</h3>
\r
517 <div class="paragraph"><p>The reply consists of a serialized tree. Each node in the tree (representing
\r
518 one container) has at least the properties listed below. While the nodes might
\r
519 have more properties, please do not use any properties which are not documented
\r
520 here. They are not yet finalized and will probably change!</p></div>
\r
521 <div class="dlist"><dl>
\r
522 <dt class="hdlist1">
\r
527 The internal ID (actually a C pointer value) of this container. Do not
\r
528 make any assumptions about it. You can use it to (re-)identify and
\r
529 address containers when talking to i3.
\r
532 <dt class="hdlist1">
\r
537 The internal name of this container. For all containers which are part
\r
538 of the tree structure down to the workspace contents, this is set to a
\r
539 nice human-readable name of the container.
\r
540 For containers that have an X11 window, the content is the title
\r
541 (_NET_WM_NAME property) of that window.
\r
542 For all other containers, the content is not defined (yet).
\r
545 <dt class="hdlist1">
\r
550 Type of this container. Can be one of "root", "output", "con",
\r
551 "floating_con", "workspace" or "dockarea".
\r
554 <dt class="hdlist1">
\r
559 Can be either "normal", "none" or "pixel", depending on the
\r
560 container’s border style.
\r
563 <dt class="hdlist1">
\r
564 current_border_width (integer)
\r
568 Number of pixels of the border width.
\r
571 <dt class="hdlist1">
\r
576 Can be either "splith", "splitv", "stacked", "tabbed", "dockarea" or
\r
578 Other values might be possible in the future, should we add new
\r
582 <dt class="hdlist1">
\r
583 orientation (string)
\r
587 Can be either "none" (for non-split containers), "horizontal" or
\r
589 THIS FIELD IS OBSOLETE. It is still present, but your code should not
\r
590 use it. Instead, rely on the layout field.
\r
593 <dt class="hdlist1">
\r
598 The percentage which this container takes in its parent. A value of
\r
599 <tt>null</tt> means that the percent property does not make sense for this
\r
600 container, for example for the root container.
\r
603 <dt class="hdlist1">
\r
608 The absolute display coordinates for this container. Display
\r
609 coordinates means that when you have two 1600x1200 monitors on a single
\r
610 X11 Display (the standard way), the coordinates of the first window on
\r
611 the second monitor are <tt>{ "x": 1600, "y": 0, "width": 1600, "height":
\r
615 <dt class="hdlist1">
\r
620 The coordinates of the <strong>actual client window</strong> inside its container.
\r
621 These coordinates are relative to the container and do not include the
\r
622 window decoration (which is actually rendered on the parent container).
\r
623 So, when using the <tt>default</tt> layout, you will have a 2 pixel border on
\r
624 each side, making the window_rect <tt>{ "x": 2, "y": 0, "width": 632,
\r
625 "height": 366 }</tt> (for example).
\r
628 <dt class="hdlist1">
\r
633 The coordinates of the <strong>window decoration</strong> inside its container. These
\r
634 coordinates are relative to the container and do not include the actual
\r
638 <dt class="hdlist1">
\r
643 The original geometry the window specified when i3 mapped it. Used when
\r
644 switching a window to floating mode, for example.
\r
647 <dt class="hdlist1">
\r
652 The X11 window ID of the <strong>actual client window</strong> inside this container.
\r
653 This field is set to null for split containers or otherwise empty
\r
654 containers. This ID corresponds to what xwininfo(1) and other
\r
655 X11-related tools display (usually in hex).
\r
658 <dt class="hdlist1">
\r
663 Whether this container (window, split container, floating container or
\r
664 workspace) has the urgency hint set, directly or indirectly. All parent
\r
665 containers up until the workspace container will be marked urgent if they
\r
666 have at least one urgent child.
\r
669 <dt class="hdlist1">
\r
674 Whether this container is currently focused.
\r
677 <dt class="hdlist1">
\r
678 focus (array of integer)
\r
682 List of child node IDs (see <tt>nodes</tt>, <tt>floating_nodes</tt> and <tt>id</tt>) in focus
\r
683 order. Traversing the tree by following the first entry in this array
\r
684 will result in eventually reaching the one node with <tt>focused</tt> set to
\r
688 <dt class="hdlist1">
\r
689 nodes (array of node)
\r
693 The tiling (i.e. non-floating) child containers of this node.
\r
696 <dt class="hdlist1">
\r
697 floating_nodes (array of node)
\r
701 The floating child containers of this node. Only non-empty on nodes with
\r
702 type <tt>workspace</tt>.
\r
706 <div class="paragraph"><p>Please note that in the following example, I have left out some keys/values
\r
707 which are not relevant for the type of the node. Otherwise, the example would
\r
708 be by far too long (it already is quite long, despite showing only 1 window and
\r
709 one dock window).</p></div>
\r
710 <div class="paragraph"><p>It is useful to have an overview of the structure before taking a look at the
\r
711 JSON dump:</p></div>
\r
712 <div class="ulist"><ul>
\r
717 <div class="ulist"><ul>
\r
722 <div class="ulist"><ul>
\r
732 <div class="ulist"><ul>
\r
737 <div class="ulist"><ul>
\r
751 <div class="ulist"><ul>
\r
769 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
770 <div class="listingblock">
\r
771 <div class="content">
\r
786 "layout": "output",
\r
798 "layout": "dockarea",
\r
799 "orientation": "vertical",
\r
822 "orientation": "horizontal",
\r
829 "floating_nodes": [],
\r
835 "border": "normal",
\r
853 "name": "bottomdock",
\r
854 "layout": "dockarea",
\r
855 "orientation": "vertical",
\r
884 <div class="sect2">
\r
885 <h3 id="_marks_reply">3.7. MARKS reply</h3>
\r
886 <div class="paragraph"><p>The reply consists of a single array of strings for each container that has a
\r
887 mark. A mark can only be set on one container, so the array is unique.
\r
888 The order of that array is undefined.</p></div>
\r
889 <div class="paragraph"><p>If no window has a mark the response will be the empty array [].</p></div>
\r
891 <div class="sect2">
\r
892 <h3 id="_bar_config_reply">3.8. BAR_CONFIG reply</h3>
\r
893 <div class="paragraph"><p>This can be used by third-party workspace bars (especially i3bar, but others
\r
894 are free to implement compatible alternatives) to get the <tt>bar</tt> block
\r
895 configuration from i3.</p></div>
\r
896 <div class="paragraph"><p>Depending on the input, the reply is either:</p></div>
\r
897 <div class="dlist"><dl>
\r
898 <dt class="hdlist1">
\r
903 An array of configured bar IDs
\r
906 <dt class="hdlist1">
\r
911 A JSON map containing the configuration for the specified bar.
\r
915 <div class="paragraph"><p>Each bar configuration has the following properties:</p></div>
\r
916 <div class="dlist"><dl>
\r
917 <dt class="hdlist1">
\r
922 The ID for this bar. Included in case you request multiple
\r
923 configurations and want to differentiate the different replies.
\r
926 <dt class="hdlist1">
\r
931 Either <tt>dock</tt> (the bar sets the dock window type) or <tt>hide</tt> (the bar
\r
932 does not show unless a specific key is pressed).
\r
935 <dt class="hdlist1">
\r
940 Either <tt>bottom</tt> or <tt>top</tt> at the moment.
\r
943 <dt class="hdlist1">
\r
944 status_command (string)
\r
948 Command which will be run to generate a statusline. Each line on stdout
\r
949 of this command will be displayed in the bar. At the moment, no
\r
950 formatting is supported.
\r
953 <dt class="hdlist1">
\r
958 The font to use for text on the bar.
\r
961 <dt class="hdlist1">
\r
962 workspace_buttons (boolean)
\r
966 Display workspace buttons or not? Defaults to true.
\r
969 <dt class="hdlist1">
\r
970 binding_mode_indicator (boolean)
\r
974 Display the mode indicator or not? Defaults to true.
\r
977 <dt class="hdlist1">
\r
982 Should the bar enable verbose output for debugging? Defaults to false.
\r
985 <dt class="hdlist1">
\r
990 Contains key/value pairs of colors. Each value is a color code in hex,
\r
991 formatted #rrggbb (like in HTML).
\r
995 <div class="paragraph"><p>The following colors can be configured at the moment:</p></div>
\r
996 <div class="dlist"><dl>
\r
997 <dt class="hdlist1">
\r
1002 Background color of the bar.
\r
1005 <dt class="hdlist1">
\r
1010 Text color to be used for the statusline.
\r
1013 <dt class="hdlist1">
\r
1018 Text color to be used for the separator.
\r
1021 <dt class="hdlist1">
\r
1022 focused_background
\r
1026 Background color of the bar on the currently focused monitor output.
\r
1029 <dt class="hdlist1">
\r
1030 focused_statusline
\r
1034 Text color to be used for the statusline on the currently focused
\r
1038 <dt class="hdlist1">
\r
1043 Text color to be used for the separator on the currently focused
\r
1047 <dt class="hdlist1">
\r
1048 focused_workspace_text/focused_workspace_bg/focused_workspace_border
\r
1052 Text/background/border color for a workspace button when the workspace
\r
1056 <dt class="hdlist1">
\r
1057 active_workspace_text/active_workspace_bg/active_workspace_border
\r
1061 Text/background/border color for a workspace button when the workspace
\r
1062 is active (visible) on some output, but the focus is on another one.
\r
1063 You can only tell this apart from the focused workspace when you are
\r
1064 using multiple monitors.
\r
1067 <dt class="hdlist1">
\r
1068 inactive_workspace_text/inactive_workspace_bg/inactive_workspace_border
\r
1072 Text/background/border color for a workspace button when the workspace
\r
1073 does not have focus and is not active (visible) on any output. This
\r
1074 will be the case for most workspaces.
\r
1077 <dt class="hdlist1">
\r
1078 urgent_workspace_text/urgent_workspace_bg/urgent_workspace_border
\r
1082 Text/background/border color for workspaces which contain at least one
\r
1083 window with the urgency hint set.
\r
1086 <dt class="hdlist1">
\r
1087 binding_mode_text/binding_mode_bg/binding_mode_border
\r
1091 Text/background/border color for the binding mode indicator.
\r
1095 <div class="paragraph"><p><strong>Example of configured bars:</strong></p></div>
\r
1096 <div class="listingblock">
\r
1097 <div class="content">
\r
1098 <pre><tt>["bar-bxuqzf"]</tt></pre>
\r
1100 <div class="paragraph"><p><strong>Example of bar configuration:</strong></p></div>
\r
1101 <div class="listingblock">
\r
1102 <div class="content">
\r
1104 "id": "bar-bxuqzf",
\r
1106 "position": "bottom",
\r
1107 "status_command": "i3status",
\r
1108 "font": "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1",
\r
1109 "workspace_buttons": true,
\r
1110 "binding_mode_indicator": true,
\r
1113 "background": "#c0c0c0",
\r
1114 "statusline": "#00ff00",
\r
1115 "focused_workspace_text": "#ffffff",
\r
1116 "focused_workspace_bg": "#000000"
\r
1121 <div class="sect2">
\r
1122 <h3 id="_version_reply">3.9. VERSION reply</h3>
\r
1123 <div class="paragraph"><p>The reply consists of a single JSON dictionary with the following keys:</p></div>
\r
1124 <div class="dlist"><dl>
\r
1125 <dt class="hdlist1">
\r
1130 The major version of i3, such as <tt>4</tt>.
\r
1133 <dt class="hdlist1">
\r
1138 The minor version of i3, such as <tt>2</tt>. Changes in the IPC interface (new
\r
1139 features) will only occur with new minor (or major) releases. However,
\r
1140 bugfixes might be introduced in patch releases, too.
\r
1143 <dt class="hdlist1">
\r
1148 The patch version of i3, such as <tt>1</tt> (when the complete version is
\r
1149 <tt>4.2.1</tt>). For versions such as <tt>4.2</tt>, patch will be set to <tt>0</tt>.
\r
1152 <dt class="hdlist1">
\r
1153 human_readable (string)
\r
1157 A human-readable version of i3 containing the precise git version,
\r
1158 build date and branch name. When you need to display the i3 version to
\r
1159 your users, use the human-readable version whenever possible (since
\r
1160 this is what <tt>i3 --version</tt> displays, too).
\r
1163 <dt class="hdlist1">
\r
1164 loaded_config_file_name (string)
\r
1168 The current config path.
\r
1172 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1173 <div class="listingblock">
\r
1174 <div class="content">
\r
1176 "human_readable" : "4.2-169-gf80b877 (2012-08-05, branch \"next\")",
\r
1177 "loaded_config_file_name" : "/home/hwangcc23/.i3/config",
\r
1184 <div class="sect2">
\r
1185 <h3 id="_binding_modes_reply">3.10. BINDING_MODES reply</h3>
\r
1186 <div class="paragraph"><p>The reply consists of an array of all currently configured binding modes.</p></div>
\r
1187 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1188 <div class="listingblock">
\r
1189 <div class="content">
\r
1190 <pre><tt>["default", "resize"]</tt></pre>
\r
1193 <div class="sect2">
\r
1194 <h3 id="_config_reply">3.11. CONFIG reply</h3>
\r
1195 <div class="paragraph"><p>The config reply is a map which currently only contains the "config" member,
\r
1196 which is a string containing the config file as loaded by i3 most recently.</p></div>
\r
1197 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1198 <div class="listingblock">
\r
1199 <div class="content">
\r
1200 <pre><tt>{ "config": "font pango:monospace 8\nbindsym Mod4+q exit\n" }</tt></pre>
\r
1203 <div class="sect2">
\r
1204 <h3 id="_tick_reply">3.12. TICK reply</h3>
\r
1205 <div class="paragraph"><p>The reply is a map containing the "success" member. After the reply was
\r
1206 received, the tick event has been written to all IPC connections which subscribe
\r
1207 to tick events. UNIX sockets are usually buffered, but you can be certain that
\r
1208 once you receive the tick event you just triggered, you must have received all
\r
1209 events generated prior to the <tt>SEND_TICK</tt> message (happened-before relation).</p></div>
\r
1210 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1211 <div class="listingblock">
\r
1212 <div class="content">
\r
1213 <pre><tt>{ "success": true }</tt></pre>
\r
1218 <div class="sect1">
\r
1219 <h2 id="_events">4. Events</h2>
\r
1220 <div class="sectionbody">
\r
1221 <div class="paragraph" id="events"><p>To get informed when certain things happen in i3, clients can subscribe to
\r
1222 events. Events consist of a name (like "workspace") and an event reply type
\r
1223 (like I3_IPC_EVENT_WORKSPACE). The events sent by i3 are in the same format
\r
1224 as replies to specific commands. However, the highest bit of the message type
\r
1225 is set to 1 to indicate that this is an event reply instead of a normal reply.</p></div>
\r
1226 <div class="paragraph"><p>Caveat: As soon as you subscribe to an event, it is not guaranteed any longer
\r
1227 that the requests to i3 are processed in order. This means, the following
\r
1228 situation can happen: You send a GET_WORKSPACES request but you receive a
\r
1229 "workspace" event before receiving the reply to GET_WORKSPACES. If your
\r
1230 program does not want to cope which such kinds of race conditions (an
\r
1231 event based library may not have a problem here), I suggest you create a
\r
1232 separate connection to receive events.</p></div>
\r
1233 <div class="sect2">
\r
1234 <h3 id="_subscribing_to_events">4.1. Subscribing to events</h3>
\r
1235 <div class="paragraph"><p>By sending a message of type SUBSCRIBE with a JSON-encoded array as payload
\r
1236 you can register to an event.</p></div>
\r
1237 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1238 <div class="listingblock">
\r
1239 <div class="content">
\r
1240 <pre><tt>type: SUBSCRIBE
\r
1241 payload: [ "workspace", "output" ]</tt></pre>
\r
1244 <div class="sect2">
\r
1245 <h3 id="_available_events">4.2. Available events</h3>
\r
1246 <div class="paragraph"><p>The numbers in parenthesis is the event type (keep in mind that you need to
\r
1247 strip the highest bit first).</p></div>
\r
1248 <div class="dlist"><dl>
\r
1249 <dt class="hdlist1">
\r
1254 Sent when the user switches to a different workspace, when a new
\r
1255 workspace is initialized or when a workspace is removed (because the
\r
1256 last client vanished).
\r
1259 <dt class="hdlist1">
\r
1264 Sent when RandR issues a change notification (of either screens,
\r
1265 outputs, CRTCs or output properties).
\r
1268 <dt class="hdlist1">
\r
1273 Sent whenever i3 changes its binding mode.
\r
1276 <dt class="hdlist1">
\r
1281 Sent when a client’s window is successfully reparented (that is when i3
\r
1282 has finished fitting it into a container), when a window received input
\r
1283 focus or when certain properties of the window have changed.
\r
1286 <dt class="hdlist1">
\r
1287 barconfig_update (4)
\r
1291 Sent when the hidden_state or mode field in the barconfig of any bar
\r
1292 instance was updated and when the config is reloaded.
\r
1295 <dt class="hdlist1">
\r
1300 Sent when a configured command binding is triggered with the keyboard or
\r
1304 <dt class="hdlist1">
\r
1309 Sent when the ipc shuts down because of a restart or exit by user command
\r
1312 <dt class="hdlist1">
\r
1317 Sent when the ipc client subscribes to the tick event (with <tt>"first":
\r
1318 true</tt>) or when any ipc client sends a SEND_TICK message (with <tt>"first":
\r
1323 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1324 <div class="listingblock">
\r
1325 <div class="content">
\r
1326 <pre><tt># the appropriate 4 bytes read from the socket are stored in $input
\r
1328 # unpack a 32-bit unsigned integer
\r
1329 my $message_type = unpack("L", $input);
\r
1331 # check if the highest bit is 1
\r
1332 my $is_event = (($message_type >> 31) == 1);
\r
1334 # use the other bits
\r
1335 my $event_type = ($message_type & 0x7F);
\r
1338 say "Received event of type $event_type";
\r
1342 <div class="sect2">
\r
1343 <h3 id="_workspace_event">4.3. workspace event</h3>
\r
1344 <div class="paragraph"><p>This event consists of a single serialized map containing a property
\r
1345 <tt>change (string)</tt> which indicates the type of the change ("focus", "init",
\r
1346 "empty", "urgent", "reload", "rename", "restored", "move"). A
\r
1347 <tt>current (object)</tt> property will be present with the affected workspace
\r
1348 whenever the type of event affects a workspace (otherwise, it will be +null).</p></div>
\r
1349 <div class="paragraph"><p>When the change is "focus", an <tt>old (object)</tt> property will be present with the
\r
1350 previous workspace. When the first switch occurs (when i3 focuses the
\r
1351 workspace visible at the beginning) there is no previous workspace, and the
\r
1352 <tt>old</tt> property will be set to <tt>null</tt>. Also note that if the previous is empty
\r
1353 it will get destroyed when switching, but will still be present in the "old"
\r
1354 property.</p></div>
\r
1355 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1356 <div class="listingblock">
\r
1357 <div class="content">
\r
1359 "change": "focus",
\r
1362 "type": "workspace",
\r
1367 "type": "workspace",
\r
1373 <div class="sect2">
\r
1374 <h3 id="_output_event">4.4. output event</h3>
\r
1375 <div class="paragraph"><p>This event consists of a single serialized map containing a property
\r
1376 <tt>change (string)</tt> which indicates the type of the change (currently only
\r
1377 "unspecified").</p></div>
\r
1378 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1379 <div class="listingblock">
\r
1380 <div class="content">
\r
1381 <pre><tt>{ "change": "unspecified" }</tt></pre>
\r
1384 <div class="sect2">
\r
1385 <h3 id="_mode_event">4.5. mode event</h3>
\r
1386 <div class="paragraph"><p>This event consists of a single serialized map containing a property
\r
1387 <tt>change (string)</tt> which holds the name of current mode in use. The name
\r
1388 is the same as specified in config when creating a mode. The default
\r
1389 mode is simply named default. It contains a second property, <tt>pango_markup</tt>, which
\r
1390 defines whether pango markup shall be used for displaying this mode.</p></div>
\r
1391 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1392 <div class="listingblock">
\r
1393 <div class="content">
\r
1395 "change": "default",
\r
1396 "pango_markup": true
\r
1400 <div class="sect2">
\r
1401 <h3 id="_window_event">4.6. window event</h3>
\r
1402 <div class="paragraph"><p>This event consists of a single serialized map containing a property
\r
1403 <tt>change (string)</tt> which indicates the type of the change</p></div>
\r
1404 <div class="ulist"><ul>
\r
1407 <tt>new</tt> – the window has become managed by i3
\r
1412 <tt>close</tt> – the window has closed
\r
1417 <tt>focus</tt> – the window has received input focus
\r
1422 <tt>title</tt> – the window’s title has changed
\r
1427 <tt>fullscreen_mode</tt> – the window has entered or exited fullscreen mode
\r
1432 <tt>move</tt> – the window has changed its position in the tree
\r
1437 <tt>floating</tt> – the window has transitioned to or from floating
\r
1442 <tt>urgent</tt> – the window has become urgent or lost its urgent status
\r
1447 <tt>mark</tt> – a mark has been added to or removed from the window
\r
1451 <div class="paragraph"><p>Additionally a <tt>container (object)</tt> field will be present, which consists
\r
1452 of the window’s parent container. Be aware that for the "new" event, the
\r
1453 container will hold the initial name of the newly reparented window (e.g.
\r
1454 if you run urxvt with a shell that changes the title, you will still at
\r
1455 this point get the window title as "urxvt").</p></div>
\r
1456 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1457 <div class="listingblock">
\r
1458 <div class="content">
\r
1469 <div class="sect2">
\r
1470 <h3 id="_barconfig_update_event">4.7. barconfig_update event</h3>
\r
1471 <div class="paragraph"><p>This event consists of a single serialized map reporting on options from the
\r
1472 barconfig of the specified bar_id that were updated in i3. This event is the
\r
1473 same as a <tt>GET_BAR_CONFIG</tt> reply for the bar with the given id.</p></div>
\r
1475 <div class="sect2">
\r
1476 <h3 id="_binding_event">4.8. binding event</h3>
\r
1477 <div class="paragraph"><p>This event consists of a single serialized map reporting on the details of a
\r
1478 binding that ran a command because of user input. The <tt>change (string)</tt> field
\r
1479 indicates what sort of binding event was triggered (right now it will always be
\r
1480 <tt>"run"</tt> but may be expanded in the future).</p></div>
\r
1481 <div class="paragraph"><p>The <tt>binding (object)</tt> field contains details about the binding that was run:</p></div>
\r
1482 <div class="dlist"><dl>
\r
1483 <dt class="hdlist1">
\r
1488 The i3 command that is configured to run for this binding.
\r
1491 <dt class="hdlist1">
\r
1492 event_state_mask (array of strings)
\r
1496 The group and modifier keys that were configured with this binding.
\r
1499 <dt class="hdlist1">
\r
1500 input_code (integer)
\r
1504 If the binding was configured with <tt>bindcode</tt>, this will be the key code
\r
1505 that was given for the binding. If the binding is a mouse binding, it will be
\r
1506 the number of the mouse button that was pressed. Otherwise it will be 0.
\r
1509 <dt class="hdlist1">
\r
1510 symbol (string or null)
\r
1514 If this is a keyboard binding that was configured with <tt>bindsym</tt>, this
\r
1515 field will contain the given symbol. Otherwise it will be <tt>null</tt>.
\r
1518 <dt class="hdlist1">
\r
1519 input_type (string)
\r
1523 This will be <tt>"keyboard"</tt> or <tt>"mouse"</tt> depending on whether or not this was
\r
1524 a keyboard or a mouse binding.
\r
1528 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1529 <div class="listingblock">
\r
1530 <div class="content">
\r
1535 "event_state_mask": [
\r
1541 "input_type": "keyboard"
\r
1546 <div class="sect2">
\r
1547 <h3 id="_shutdown_event">4.9. shutdown event</h3>
\r
1548 <div class="paragraph"><p>This event is triggered when the connection to the ipc is about to shutdown
\r
1549 because of a user action such as a <tt>restart</tt> or <tt>exit</tt> command. The <tt>change
\r
1550 (string)</tt> field indicates why the ipc is shutting down. It can be either
\r
1551 <tt>"restart"</tt> or <tt>"exit"</tt>.</p></div>
\r
1552 <div class="paragraph"><p><strong>Example:</strong></p></div>
\r
1553 <div class="listingblock">
\r
1554 <div class="content">
\r
1556 "change": "restart"
\r
1560 <div class="sect2">
\r
1561 <h3 id="_tick_event">4.10. tick event</h3>
\r
1562 <div class="paragraph"><p>This event is triggered by a subscription to tick events or by a <tt>SEND_TICK</tt>
\r
1563 message.</p></div>
\r
1564 <div class="paragraph"><p><strong>Example (upon subscription):</strong></p></div>
\r
1565 <div class="listingblock">
\r
1566 <div class="content">
\r
1572 <div class="paragraph"><p><strong>Example (upon <tt>SEND_TICK</tt> with a payload of <tt>arbitrary string</tt>):</strong></p></div>
\r
1573 <div class="listingblock">
\r
1574 <div class="content">
\r
1577 "payload": "arbitrary string"
\r
1583 <div class="sect1">
\r
1584 <h2 id="_see_also_existing_libraries">5. See also (existing libraries)</h2>
\r
1585 <div class="sectionbody">
\r
1586 <div class="paragraph" id="libraries"><p>For some languages, libraries are available (so you don’t have to implement
\r
1587 all this on your own). This list names some (if you wrote one, please let me
\r
1589 <div class="dlist"><dl>
\r
1590 <dt class="hdlist1">
\r
1594 <div class="ulist"><ul>
\r
1597 i3 includes a headerfile <tt>i3/ipc.h</tt> which provides you all constants.
\r
1602 <a href="https://github.com/acrisci/i3ipc-glib">https://github.com/acrisci/i3ipc-glib</a>
\r
1607 <dt class="hdlist1">
\r
1611 <div class="ulist"><ul>
\r
1614 <a href="https://github.com/drmgc/i3ipcpp">https://github.com/drmgc/i3ipcpp</a>
\r
1619 <dt class="hdlist1">
\r
1623 <div class="ulist"><ul>
\r
1626 <a href="https://github.com/mdirkse/i3ipc-go">https://github.com/mdirkse/i3ipc-go</a>
\r
1631 <a href="https://github.com/i3/go-i3">https://github.com/i3/go-i3</a>
\r
1636 <dt class="hdlist1">
\r
1640 <div class="ulist"><ul>
\r
1643 <a href="https://github.com/acrisci/i3ipc-gjs">https://github.com/acrisci/i3ipc-gjs</a>
\r
1648 <dt class="hdlist1">
\r
1652 <div class="ulist"><ul>
\r
1655 <a href="https://github.com/acrisci/i3ipc-lua">https://github.com/acrisci/i3ipc-lua</a>
\r
1660 <dt class="hdlist1">
\r
1664 <div class="ulist"><ul>
\r
1667 <a href="https://metacpan.org/module/AnyEvent::I3">https://metacpan.org/module/AnyEvent::I3</a>
\r
1672 <dt class="hdlist1">
\r
1676 <div class="ulist"><ul>
\r
1679 <a href="https://github.com/acrisci/i3ipc-python">https://github.com/acrisci/i3ipc-python</a>
\r
1684 <a href="https://github.com/whitelynx/i3ipc">https://github.com/whitelynx/i3ipc</a> (not maintained)
\r
1689 <a href="https://github.com/ziberna/i3-py">https://github.com/ziberna/i3-py</a> (not maintained)
\r
1694 <dt class="hdlist1">
\r
1698 <div class="ulist"><ul>
\r
1701 <a href="https://github.com/veelenga/i3ipc-ruby">https://github.com/veelenga/i3ipc-ruby</a>
\r
1706 <a href="https://github.com/badboy/i3-ipc">https://github.com/badboy/i3-ipc</a> (not maintained)
\r
1711 <dt class="hdlist1">
\r
1715 <div class="ulist"><ul>
\r
1718 <a href="https://github.com/tmerr/i3ipc-rs">https://github.com/tmerr/i3ipc-rs</a>
\r
1723 <dt class="hdlist1">
\r
1727 <div class="ulist"><ul>
\r
1730 <a href="https://github.com/Armael/ocaml-i3ipc">https://github.com/Armael/ocaml-i3ipc</a>
\r
1738 <div class="sect1">
\r
1739 <h2 id="_appendix_a_detecting_byte_order_in_memory_safe_languages">6. Appendix A: Detecting byte order in memory-safe languages</h2>
\r
1740 <div class="sectionbody">
\r
1741 <div class="paragraph"><p>Some programming languages such as Go don’t offer a way to serialize data in the
\r
1742 native byte order of the machine they’re running on without resorting to tricks
\r
1743 involving the <tt>unsafe</tt> package.</p></div>
\r
1744 <div class="paragraph"><p>The following technique can be used (and will not be broken by changes to i3) to
\r
1745 detect the byte order i3 is using:</p></div>
\r
1746 <div class="olist arabic"><ol class="arabic">
\r
1749 The byte order dependent fields of an IPC message are message type and
\r
1752 <div class="ulist"><ul>
\r
1755 The message type <tt>RUN_COMMAND</tt> (0) is the same in big and little endian, so
\r
1756 we can use it in either byte order to elicit a reply from i3.
\r
1761 The payload length 65536 + 256 (<tt>0x00 01 01 00</tt>) is the same in big and
\r
1762 little endian, and also small enough to not worry about memory allocations
\r
1763 of that size. We must use payloads of length 65536 + 256 in every message
\r
1764 we send, so that i3 will be able to read the entire message regardless of
\r
1765 the byte order it uses.
\r
1772 Send a big endian encoded message of type <tt>SUBSCRIBE</tt> (2) with payload <tt>[]</tt>
\r
1773 followed by 65536 + 256 - 2 <tt>SPACE</tt> (ASCII 0x20) bytes.
\r
1775 <div class="ulist"><ul>
\r
1778 If i3 is running in big endian, this message is treated as a noop,
\r
1779 resulting in a <tt>SUBSCRIBE</tt> reply with payload <tt>{"success":true}</tt>
\r
1780 <span class="footnote"><br />[A small payload is important: that way, we circumvent dealing
\r
1781 with UNIX domain socket buffer sizes, whose size depends on the
\r
1782 implementation/operating system. Exhausting such a buffer results in an i3
\r
1783 deadlock unless you concurrently read and write, which — depending on the
\r
1784 programming language — makes the technique much more complicated.]<br /></span>.
\r
1789 If i3 is running in little endian, this message is read in its entirety due
\r
1790 to the byte order independent payload length, then
\r
1791 <a href="https://github.com/i3/i3/blob/d726d09d496577d1c337a4b97486f2c9fbc914f1/src/ipc.c#L1188">silently
\r
1792 discarded</a> due to the unknown message type.
\r
1799 Send a byte order independent message, i.e. type <tt>RUN_COMMAND</tt> (0) with
\r
1800 payload <tt>nop byte order detection. padding:</tt>, padded to 65536 + 256 bytes
\r
1801 with <tt>a</tt> (ASCII 0x61) bytes. i3 will reply to this message with a reply of
\r
1802 type <tt>COMMAND</tt> (0).
\r
1804 <div class="ulist"><ul>
\r
1807 The human-readable prefix is in there to not confuse readers of the i3 log.
\r
1812 This messages serves as a synchronization primitive so that we know whether
\r
1813 i3 discarded the <tt>SUBSCRIBE</tt> message or didn’t answer it yet.
\r
1820 Receive a message header from i3, decoding the message type as big endian.
\r
1822 <div class="ulist"><ul>
\r
1825 If the message’s reply type is <tt>COMMAND</tt> (0), i3 is running in little
\r
1826 endian (because the <tt>SUBSCRIBE</tt> message was discarded). Decode the message
\r
1827 payload length as little endian, receive the message payload.
\r
1832 If the message’s reply type is anything else, i3 is running in big endian
\r
1833 (because our big endian encoded <tt>SUBSCRIBE</tt> message was answered). Decode
\r
1834 the message payload length in big endian, receive the message
\r
1835 payload. Then, receive the pending <tt>COMMAND</tt> message reply in big endian.
\r
1842 From here on out, send/receive all messages using the detected byte order.
\r
1846 <div class="paragraph"><p>Find an example implementation of this technique in
\r
1847 <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
1851 <div id="footnotes"><hr /></div>
\r
1852 <div id="footer" lang="de">
\r
1853 © 2009-2011 Michael Stapelberg, <a href="/impress.html">Impressum</a>
\r