]> git.sur5r.net Git - i3/i3.github.io/blob - docs/4.12/ipc.html
save docs for 4.12
[i3/i3.github.io] / docs / 4.12 / ipc.html
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
4 <head>\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
12 /*<![CDATA[*/\r
13 document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); asciidoc.toc(2);}, false);\r
14 /*]]>*/\r
15 </script>\r
16 <script type="text/javascript" src="/js/asciidoc-xhtml11.js"></script>\r
17 </head>\r
18 <body class="article">\r
19 \r
20         <div id="main">\r
21             <a href="/"><h1 id="title">i3 - improved tiling WM</h1></a>\r
22                         <ul id="nav">\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
28                         </ul>\r
29         <br style="clear: both">\r
30 <div id="content">\r
31 <div id="header">\r
32 <h1>IPC interface (interprocess communication)</h1>\r
33 <span id="author">Michael Stapelberg</span><br />\r
34 <span id="email"><tt>&lt;<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>&gt;</tt></span><br />\r
35 <span id="revdate">October 2014</span>\r
36 <div id="toc">
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>
39 </div>\r
40 </div>\r
41 <div id="preamble">\r
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
57 <table><tr>\r
58 <td class="icon">\r
59 <div class="title">Warning</div>\r
60 </td>\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
65 directly.</td>\r
66 </tr></table>\r
67 </div>\r
68 </div>\r
69 </div>\r
70 <div class="sect1">\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-&gt;new(Peer =&gt; $path);</tt></pre>\r
80 </div></div>\r
81 </div>\r
82 </div>\r
83 <div class="sect1">\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="paragraph"><p>Currently implemented message types are the following:</p></div>\r
96 <div class="dlist"><dl>\r
97 <dt class="hdlist1">\r
98 COMMAND (0)\r
99 </dt>\r
100 <dd>\r
101 <p>\r
102         The payload of the message is a command for i3 (like the commands you\r
103         can bind to keys in the configuration file) and will be executed\r
104         directly after receiving it.\r
105 </p>\r
106 </dd>\r
107 <dt class="hdlist1">\r
108 GET_WORKSPACES (1)\r
109 </dt>\r
110 <dd>\r
111 <p>\r
112         Gets the current workspaces. The reply will be a JSON-encoded list of\r
113         workspaces (see the reply section).\r
114 </p>\r
115 </dd>\r
116 <dt class="hdlist1">\r
117 SUBSCRIBE (2)\r
118 </dt>\r
119 <dd>\r
120 <p>\r
121         Subscribes your connection to certain events. See <a href="#events">[events]</a> for a\r
122         description of this message and the concept of events.\r
123 </p>\r
124 </dd>\r
125 <dt class="hdlist1">\r
126 GET_OUTPUTS (3)\r
127 </dt>\r
128 <dd>\r
129 <p>\r
130         Gets the current outputs. The reply will be a JSON-encoded list of outputs\r
131         (see the reply section).\r
132 </p>\r
133 </dd>\r
134 <dt class="hdlist1">\r
135 GET_TREE (4)\r
136 </dt>\r
137 <dd>\r
138 <p>\r
139         Gets the layout tree. i3 uses a tree as data structure which includes\r
140         every container. The reply will be the JSON-encoded tree (see the reply\r
141         section).\r
142 </p>\r
143 </dd>\r
144 <dt class="hdlist1">\r
145 GET_MARKS (5)\r
146 </dt>\r
147 <dd>\r
148 <p>\r
149         Gets a list of marks (identifiers for containers to easily jump to them\r
150         later). The reply will be a JSON-encoded list of window marks (see\r
151         reply section).\r
152 </p>\r
153 </dd>\r
154 <dt class="hdlist1">\r
155 GET_BAR_CONFIG (6)\r
156 </dt>\r
157 <dd>\r
158 <p>\r
159         Gets the configuration (as JSON map) of the workspace bar with the\r
160         given ID. If no ID is provided, an array with all configured bar IDs is\r
161         returned instead.\r
162 </p>\r
163 </dd>\r
164 <dt class="hdlist1">\r
165 GET_VERSION (7)\r
166 </dt>\r
167 <dd>\r
168 <p>\r
169         Gets the version of i3. The reply will be a JSON-encoded dictionary\r
170         with the major, minor, patch and human-readable version.\r
171 </p>\r
172 </dd>\r
173 </dl></div>\r
174 <div class="paragraph"><p>So, a typical message could look like this:</p></div>\r
175 <div class="listingblock">\r
176 <div class="content">\r
177 <pre><tt>"i3-ipc" &lt;message length&gt; &lt;message type&gt; &lt;payload&gt;</tt></pre>\r
178 </div></div>\r
179 <div class="paragraph"><p>Or, as a hexdump:</p></div>\r
180 <div class="listingblock">\r
181 <div class="content">\r
182 <pre><tt>00000000  69 33 2d 69 70 63 04 00  00 00 00 00 00 00 65 78  |i3-ipc........ex|\r
183 00000010  69 74                                             |it|</tt></pre>\r
184 </div></div>\r
185 <div class="paragraph"><p>To generate and send such a message, you could use the following code in Perl:</p></div>\r
186 <div class="listingblock">\r
187 <div class="content">\r
188 <pre><tt>sub format_ipc_command {\r
189     my ($msg) = @_;\r
190     my $len;\r
191     # Get the real byte count (vs. amount of characters)\r
192     { use bytes; $len = length($msg); }\r
193     return "i3-ipc" . pack("LL", $len, 0) . $msg;\r
194 }\r
195 \r
196 $sock-&gt;write(format_ipc_command("exit"));</tt></pre>\r
197 </div></div>\r
198 </div>\r
199 </div>\r
200 <div class="sect1">\r
201 <h2 id="_receiving_replies_from_i3">3. Receiving replies from i3</h2>\r
202 <div class="sectionbody">\r
203 <div class="paragraph"><p>Replies from i3 usually consist of a simple string (the length of the string\r
204 is the message_length, so you can consider them length-prefixed) which in turn\r
205 contain the JSON serialization of a data structure. For example, the\r
206 GET_WORKSPACES message returns an array of workspaces (each workspace is a map\r
207 with certain attributes).</p></div>\r
208 <div class="sect2">\r
209 <h3 id="_reply_format">3.1. Reply format</h3>\r
210 <div class="paragraph"><p>The reply format is identical to the normal message format. There also is\r
211 the magic string, then the message length, then the message type and the\r
212 payload.</p></div>\r
213 <div class="paragraph"><p>The following reply types are implemented:</p></div>\r
214 <div class="dlist"><dl>\r
215 <dt class="hdlist1">\r
216 COMMAND (0)\r
217 </dt>\r
218 <dd>\r
219 <p>\r
220         Confirmation/Error code for the COMMAND message.\r
221 </p>\r
222 </dd>\r
223 <dt class="hdlist1">\r
224 WORKSPACES (1)\r
225 </dt>\r
226 <dd>\r
227 <p>\r
228         Reply to the GET_WORKSPACES message.\r
229 </p>\r
230 </dd>\r
231 <dt class="hdlist1">\r
232 SUBSCRIBE (2)\r
233 </dt>\r
234 <dd>\r
235 <p>\r
236         Confirmation/Error code for the SUBSCRIBE message.\r
237 </p>\r
238 </dd>\r
239 <dt class="hdlist1">\r
240 OUTPUTS (3)\r
241 </dt>\r
242 <dd>\r
243 <p>\r
244         Reply to the GET_OUTPUTS message.\r
245 </p>\r
246 </dd>\r
247 <dt class="hdlist1">\r
248 TREE (4)\r
249 </dt>\r
250 <dd>\r
251 <p>\r
252         Reply to the GET_TREE message.\r
253 </p>\r
254 </dd>\r
255 <dt class="hdlist1">\r
256 MARKS (5)\r
257 </dt>\r
258 <dd>\r
259 <p>\r
260         Reply to the GET_MARKS message.\r
261 </p>\r
262 </dd>\r
263 <dt class="hdlist1">\r
264 BAR_CONFIG (6)\r
265 </dt>\r
266 <dd>\r
267 <p>\r
268         Reply to the GET_BAR_CONFIG message.\r
269 </p>\r
270 </dd>\r
271 <dt class="hdlist1">\r
272 VERSION (7)\r
273 </dt>\r
274 <dd>\r
275 <p>\r
276         Reply to the GET_VERSION message.\r
277 </p>\r
278 </dd>\r
279 </dl></div>\r
280 </div>\r
281 <div class="sect2">\r
282 <h3 id="_command_reply">3.2. COMMAND reply</h3>\r
283 <div class="paragraph"><p>The reply consists of a list of serialized maps for each command that was\r
284 parsed. Each has the property <tt>success (bool)</tt> and may also include a\r
285 human-readable error message in the property <tt>error (string)</tt>.</p></div>\r
286 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
287 <div class="listingblock">\r
288 <div class="content">\r
289 <pre><tt>[{ "success": true }]</tt></pre>\r
290 </div></div>\r
291 </div>\r
292 <div class="sect2">\r
293 <h3 id="_workspaces_reply">3.3. WORKSPACES reply</h3>\r
294 <div class="paragraph"><p>The reply consists of a serialized list of workspaces. Each workspace has the\r
295 following properties:</p></div>\r
296 <div class="dlist"><dl>\r
297 <dt class="hdlist1">\r
298 num (integer)\r
299 </dt>\r
300 <dd>\r
301 <p>\r
302         The logical number of the workspace. Corresponds to the command\r
303         to switch to this workspace. For named workspaces, this will be -1.\r
304 </p>\r
305 </dd>\r
306 <dt class="hdlist1">\r
307 name (string)\r
308 </dt>\r
309 <dd>\r
310 <p>\r
311         The name of this workspace (by default num+1), as changed by the\r
312         user. Encoded in UTF-8.\r
313 </p>\r
314 </dd>\r
315 <dt class="hdlist1">\r
316 visible (boolean)\r
317 </dt>\r
318 <dd>\r
319 <p>\r
320         Whether this workspace is currently visible on an output (multiple\r
321         workspaces can be visible at the same time).\r
322 </p>\r
323 </dd>\r
324 <dt class="hdlist1">\r
325 focused (boolean)\r
326 </dt>\r
327 <dd>\r
328 <p>\r
329         Whether this workspace currently has the focus (only one workspace\r
330         can have the focus at the same time).\r
331 </p>\r
332 </dd>\r
333 <dt class="hdlist1">\r
334 urgent (boolean)\r
335 </dt>\r
336 <dd>\r
337 <p>\r
338         Whether a window on this workspace has the "urgent" flag set.\r
339 </p>\r
340 </dd>\r
341 <dt class="hdlist1">\r
342 rect (map)\r
343 </dt>\r
344 <dd>\r
345 <p>\r
346         The rectangle of this workspace (equals the rect of the output it\r
347         is on), consists of x, y, width, height.\r
348 </p>\r
349 </dd>\r
350 <dt class="hdlist1">\r
351 output (string)\r
352 </dt>\r
353 <dd>\r
354 <p>\r
355         The video output this workspace is on (LVDS1, VGA1, …).\r
356 </p>\r
357 </dd>\r
358 </dl></div>\r
359 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
360 <div class="listingblock">\r
361 <div class="content">\r
362 <pre><tt>[\r
363  {\r
364   "num": 0,\r
365   "name": "1",\r
366   "visible": true,\r
367   "focused": true,\r
368   "urgent": false,\r
369   "rect": {\r
370    "x": 0,\r
371    "y": 0,\r
372    "width": 1280,\r
373    "height": 800\r
374   },\r
375   "output": "LVDS1"\r
376  },\r
377  {\r
378   "num": 1,\r
379   "name": "2",\r
380   "visible": false,\r
381   "focused": false,\r
382   "urgent": false,\r
383   "rect": {\r
384    "x": 0,\r
385    "y": 0,\r
386    "width": 1280,\r
387    "height": 800\r
388   },\r
389   "output": "LVDS1"\r
390  }\r
391 ]</tt></pre>\r
392 </div></div>\r
393 </div>\r
394 <div class="sect2">\r
395 <h3 id="_subscribe_reply">3.4. SUBSCRIBE reply</h3>\r
396 <div class="paragraph"><p>The reply consists of a single serialized map. The only property is\r
397 <tt>success (bool)</tt>, indicating whether the subscription was successful (the\r
398 default) or whether a JSON parse error occurred.</p></div>\r
399 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
400 <div class="listingblock">\r
401 <div class="content">\r
402 <pre><tt>{ "success": true }</tt></pre>\r
403 </div></div>\r
404 </div>\r
405 <div class="sect2">\r
406 <h3 id="_outputs_reply">3.5. OUTPUTS reply</h3>\r
407 <div class="paragraph"><p>The reply consists of a serialized list of outputs. Each output has the\r
408 following properties:</p></div>\r
409 <div class="dlist"><dl>\r
410 <dt class="hdlist1">\r
411 name (string)\r
412 </dt>\r
413 <dd>\r
414 <p>\r
415         The name of this output (as seen in <tt>xrandr(1)</tt>). Encoded in UTF-8.\r
416 </p>\r
417 </dd>\r
418 <dt class="hdlist1">\r
419 active (boolean)\r
420 </dt>\r
421 <dd>\r
422 <p>\r
423         Whether this output is currently active (has a valid mode).\r
424 </p>\r
425 </dd>\r
426 <dt class="hdlist1">\r
427 current_workspace (string)\r
428 </dt>\r
429 <dd>\r
430 <p>\r
431         The name of the current workspace that is visible on this output. <tt>null</tt> if\r
432         the output is not active.\r
433 </p>\r
434 </dd>\r
435 <dt class="hdlist1">\r
436 rect (map)\r
437 </dt>\r
438 <dd>\r
439 <p>\r
440         The rectangle of this output (equals the rect of the output it\r
441         is on), consists of x, y, width, height.\r
442 </p>\r
443 </dd>\r
444 </dl></div>\r
445 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
446 <div class="listingblock">\r
447 <div class="content">\r
448 <pre><tt>[\r
449  {\r
450   "name": "LVDS1",\r
451   "active": true,\r
452   "current_workspace": "4",\r
453   "rect": {\r
454    "x": 0,\r
455    "y": 0,\r
456    "width": 1280,\r
457    "height": 800\r
458   }\r
459  },\r
460  {\r
461   "name": "VGA1",\r
462   "active": true,\r
463   "current_workspace": "1",\r
464   "rect": {\r
465    "x": 1280,\r
466    "y": 0,\r
467    "width": 1280,\r
468    "height": 1024\r
469   },\r
470  }\r
471 ]</tt></pre>\r
472 </div></div>\r
473 </div>\r
474 <div class="sect2">\r
475 <h3 id="_tree_reply">3.6. TREE reply</h3>\r
476 <div class="paragraph"><p>The reply consists of a serialized tree. Each node in the tree (representing\r
477 one container) has at least the properties listed below. While the nodes might\r
478 have more properties, please do not use any properties which are not documented\r
479 here. They are not yet finalized and will probably change!</p></div>\r
480 <div class="dlist"><dl>\r
481 <dt class="hdlist1">\r
482 id (integer)\r
483 </dt>\r
484 <dd>\r
485 <p>\r
486         The internal ID (actually a C pointer value) of this container. Do not\r
487         make any assumptions about it. You can use it to (re-)identify and\r
488         address containers when talking to i3.\r
489 </p>\r
490 </dd>\r
491 <dt class="hdlist1">\r
492 name (string)\r
493 </dt>\r
494 <dd>\r
495 <p>\r
496         The internal name of this container. For all containers which are part\r
497         of the tree structure down to the workspace contents, this is set to a\r
498         nice human-readable name of the container.\r
499         For containers that have an X11 window, the content is the title\r
500         (_NET_WM_NAME property) of that window.\r
501         For all other containers, the content is not defined (yet).\r
502 </p>\r
503 </dd>\r
504 <dt class="hdlist1">\r
505 type (string)\r
506 </dt>\r
507 <dd>\r
508 <p>\r
509         Type of this container. Can be one of "root", "output", "con",\r
510         "floating_con", "workspace" or "dockarea".\r
511 </p>\r
512 </dd>\r
513 <dt class="hdlist1">\r
514 border (string)\r
515 </dt>\r
516 <dd>\r
517 <p>\r
518         Can be either "normal", "none" or "1pixel", dependending on the\r
519         container’s border style.\r
520 </p>\r
521 </dd>\r
522 <dt class="hdlist1">\r
523 current_border_width (integer)\r
524 </dt>\r
525 <dd>\r
526 <p>\r
527         Number of pixels of the border width.\r
528 </p>\r
529 </dd>\r
530 <dt class="hdlist1">\r
531 layout (string)\r
532 </dt>\r
533 <dd>\r
534 <p>\r
535         Can be either "splith", "splitv", "stacked", "tabbed", "dockarea" or\r
536         "output".\r
537         Other values might be possible in the future, should we add new\r
538         layouts.\r
539 </p>\r
540 </dd>\r
541 <dt class="hdlist1">\r
542 orientation (string)\r
543 </dt>\r
544 <dd>\r
545 <p>\r
546         Can be either "none" (for non-split containers), "horizontal" or\r
547         "vertical".\r
548         THIS FIELD IS OBSOLETE. It is still present, but your code should not\r
549         use it. Instead, rely on the layout field.\r
550 </p>\r
551 </dd>\r
552 <dt class="hdlist1">\r
553 percent (float)\r
554 </dt>\r
555 <dd>\r
556 <p>\r
557         The percentage which this container takes in its parent. A value of\r
558         <tt>null</tt> means that the percent property does not make sense for this\r
559         container, for example for the root container.\r
560 </p>\r
561 </dd>\r
562 <dt class="hdlist1">\r
563 rect (map)\r
564 </dt>\r
565 <dd>\r
566 <p>\r
567         The absolute display coordinates for this container. Display\r
568         coordinates means that when you have two 1600x1200 monitors on a single\r
569         X11 Display (the standard way), the coordinates of the first window on\r
570         the second monitor are <tt>{ "x": 1600, "y": 0, "width": 1600, "height":\r
571         1200 }</tt>.\r
572 </p>\r
573 </dd>\r
574 <dt class="hdlist1">\r
575 window_rect (map)\r
576 </dt>\r
577 <dd>\r
578 <p>\r
579         The coordinates of the <strong>actual client window</strong> inside its container.\r
580         These coordinates are relative to the container and do not include the\r
581         window decoration (which is actually rendered on the parent container).\r
582         So, when using the <tt>default</tt> layout, you will have a 2 pixel border on\r
583         each side, making the window_rect <tt>{ "x": 2, "y": 0, "width": 632,\r
584         "height": 366 }</tt> (for example).\r
585 </p>\r
586 </dd>\r
587 <dt class="hdlist1">\r
588 deco_rect (map)\r
589 </dt>\r
590 <dd>\r
591 <p>\r
592         The coordinates of the <strong>window decoration</strong> inside its container. These\r
593         coordinates are relative to the container and do not include the actual\r
594         client window.\r
595 </p>\r
596 </dd>\r
597 <dt class="hdlist1">\r
598 geometry (map)\r
599 </dt>\r
600 <dd>\r
601 <p>\r
602         The original geometry the window specified when i3 mapped it. Used when\r
603         switching a window to floating mode, for example.\r
604 </p>\r
605 </dd>\r
606 <dt class="hdlist1">\r
607 window (integer)\r
608 </dt>\r
609 <dd>\r
610 <p>\r
611         The X11 window ID of the <strong>actual client window</strong> inside this container.\r
612         This field is set to null for split containers or otherwise empty\r
613         containers. This ID corresponds to what xwininfo(1) and other\r
614         X11-related tools display (usually in hex).\r
615 </p>\r
616 </dd>\r
617 <dt class="hdlist1">\r
618 urgent (bool)\r
619 </dt>\r
620 <dd>\r
621 <p>\r
622         Whether this container (window or workspace) has the urgency hint set.\r
623 </p>\r
624 </dd>\r
625 <dt class="hdlist1">\r
626 focused (bool)\r
627 </dt>\r
628 <dd>\r
629 <p>\r
630         Whether this container is currently focused.\r
631 </p>\r
632 </dd>\r
633 </dl></div>\r
634 <div class="paragraph"><p>Please note that in the following example, I have left out some keys/values\r
635 which are not relevant for the type of the node. Otherwise, the example would\r
636 be by far too long (it already is quite long, despite showing only 1 window and\r
637 one dock window).</p></div>\r
638 <div class="paragraph"><p>It is useful to have an overview of the structure before taking a look at the\r
639 JSON dump:</p></div>\r
640 <div class="ulist"><ul>\r
641 <li>\r
642 <p>\r
643 root\r
644 </p>\r
645 <div class="ulist"><ul>\r
646 <li>\r
647 <p>\r
648 LVDS1\r
649 </p>\r
650 <div class="ulist"><ul>\r
651 <li>\r
652 <p>\r
653 topdock\r
654 </p>\r
655 </li>\r
656 <li>\r
657 <p>\r
658 content\r
659 </p>\r
660 <div class="ulist"><ul>\r
661 <li>\r
662 <p>\r
663 workspace 1\r
664 </p>\r
665 <div class="ulist"><ul>\r
666 <li>\r
667 <p>\r
668 window 1\r
669 </p>\r
670 </li>\r
671 </ul></div>\r
672 </li>\r
673 </ul></div>\r
674 </li>\r
675 <li>\r
676 <p>\r
677 bottomdock\r
678 </p>\r
679 <div class="ulist"><ul>\r
680 <li>\r
681 <p>\r
682 dock window 1\r
683 </p>\r
684 </li>\r
685 </ul></div>\r
686 </li>\r
687 </ul></div>\r
688 </li>\r
689 <li>\r
690 <p>\r
691 VGA1\r
692 </p>\r
693 </li>\r
694 </ul></div>\r
695 </li>\r
696 </ul></div>\r
697 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
698 <div class="listingblock">\r
699 <div class="content">\r
700 <pre><tt>{\r
701  "id": 6875648,\r
702  "name": "root",\r
703  "rect": {\r
704    "x": 0,\r
705    "y": 0,\r
706    "width": 1280,\r
707    "height": 800\r
708  },\r
709  "nodes": [\r
710 \r
711    {\r
712     "id": 6878320,\r
713     "name": "LVDS1",\r
714     "layout": "output",\r
715     "rect": {\r
716       "x": 0,\r
717       "y": 0,\r
718       "width": 1280,\r
719       "height": 800\r
720     },\r
721     "nodes": [\r
722 \r
723       {\r
724        "id": 6878784,\r
725        "name": "topdock",\r
726        "layout": "dockarea",\r
727        "orientation": "vertical",\r
728        "rect": {\r
729          "x": 0,\r
730          "y": 0,\r
731          "width": 1280,\r
732          "height": 0\r
733        },\r
734       },\r
735 \r
736       {\r
737        "id": 6879344,\r
738        "name": "content",\r
739        "rect": {\r
740          "x": 0,\r
741          "y": 0,\r
742          "width": 1280,\r
743          "height": 782\r
744        },\r
745        "nodes": [\r
746 \r
747          {\r
748           "id": 6880464,\r
749           "name": "1",\r
750           "orientation": "horizontal",\r
751           "rect": {\r
752             "x": 0,\r
753             "y": 0,\r
754             "width": 1280,\r
755             "height": 782\r
756           },\r
757           "floating_nodes": [],\r
758           "nodes": [\r
759 \r
760             {\r
761              "id": 6929968,\r
762              "name": "#aa0000",\r
763              "border": "normal",\r
764              "percent": 1,\r
765              "rect": {\r
766                "x": 0,\r
767                "y": 18,\r
768                "width": 1280,\r
769                "height": 782\r
770              }\r
771             }\r
772 \r
773           ]\r
774          }\r
775 \r
776        ]\r
777       },\r
778 \r
779       {\r
780        "id": 6880208,\r
781        "name": "bottomdock",\r
782        "layout": "dockarea",\r
783        "orientation": "vertical",\r
784        "rect": {\r
785          "x": 0,\r
786          "y": 782,\r
787          "width": 1280,\r
788          "height": 18\r
789        },\r
790        "nodes": [\r
791 \r
792          {\r
793           "id": 6931312,\r
794           "name": "#00aa00",\r
795           "percent": 1,\r
796           "rect": {\r
797             "x": 0,\r
798             "y": 782,\r
799             "width": 1280,\r
800             "height": 18\r
801           }\r
802          }\r
803 \r
804        ]\r
805       }\r
806     ]\r
807    }\r
808  ]\r
809 }</tt></pre>\r
810 </div></div>\r
811 </div>\r
812 <div class="sect2">\r
813 <h3 id="_marks_reply">3.7. MARKS reply</h3>\r
814 <div class="paragraph"><p>The reply consists of a single array of strings for each container that has a\r
815 mark. A mark can only be set on one container, so the array is unique.\r
816 The order of that array is undefined.</p></div>\r
817 <div class="paragraph"><p>If no window has a mark the response will be the empty array [].</p></div>\r
818 </div>\r
819 <div class="sect2">\r
820 <h3 id="_bar_config_reply">3.8. BAR_CONFIG reply</h3>\r
821 <div class="paragraph"><p>This can be used by third-party workspace bars (especially i3bar, but others\r
822 are free to implement compatible alternatives) to get the <tt>bar</tt> block\r
823 configuration from i3.</p></div>\r
824 <div class="paragraph"><p>Depending on the input, the reply is either:</p></div>\r
825 <div class="dlist"><dl>\r
826 <dt class="hdlist1">\r
827 empty input\r
828 </dt>\r
829 <dd>\r
830 <p>\r
831         An array of configured bar IDs\r
832 </p>\r
833 </dd>\r
834 <dt class="hdlist1">\r
835 Bar ID\r
836 </dt>\r
837 <dd>\r
838 <p>\r
839         A JSON map containing the configuration for the specified bar.\r
840 </p>\r
841 </dd>\r
842 </dl></div>\r
843 <div class="paragraph"><p>Each bar configuration has the following properties:</p></div>\r
844 <div class="dlist"><dl>\r
845 <dt class="hdlist1">\r
846 id (string)\r
847 </dt>\r
848 <dd>\r
849 <p>\r
850         The ID for this bar. Included in case you request multiple\r
851         configurations and want to differentiate the different replies.\r
852 </p>\r
853 </dd>\r
854 <dt class="hdlist1">\r
855 mode (string)\r
856 </dt>\r
857 <dd>\r
858 <p>\r
859         Either <tt>dock</tt> (the bar sets the dock window type) or <tt>hide</tt> (the bar\r
860         does not show unless a specific key is pressed).\r
861 </p>\r
862 </dd>\r
863 <dt class="hdlist1">\r
864 position (string)\r
865 </dt>\r
866 <dd>\r
867 <p>\r
868         Either <tt>bottom</tt> or <tt>top</tt> at the moment.\r
869 </p>\r
870 </dd>\r
871 <dt class="hdlist1">\r
872 status_command (string)\r
873 </dt>\r
874 <dd>\r
875 <p>\r
876         Command which will be run to generate a statusline. Each line on stdout\r
877         of this command will be displayed in the bar. At the moment, no\r
878         formatting is supported.\r
879 </p>\r
880 </dd>\r
881 <dt class="hdlist1">\r
882 font (string)\r
883 </dt>\r
884 <dd>\r
885 <p>\r
886         The font to use for text on the bar.\r
887 </p>\r
888 </dd>\r
889 <dt class="hdlist1">\r
890 workspace_buttons (boolean)\r
891 </dt>\r
892 <dd>\r
893 <p>\r
894         Display workspace buttons or not? Defaults to true.\r
895 </p>\r
896 </dd>\r
897 <dt class="hdlist1">\r
898 binding_mode_indicator (boolean)\r
899 </dt>\r
900 <dd>\r
901 <p>\r
902         Display the mode indicator or not? Defaults to true.\r
903 </p>\r
904 </dd>\r
905 <dt class="hdlist1">\r
906 verbose (boolean)\r
907 </dt>\r
908 <dd>\r
909 <p>\r
910         Should the bar enable verbose output for debugging? Defaults to false.\r
911 </p>\r
912 </dd>\r
913 <dt class="hdlist1">\r
914 colors (map)\r
915 </dt>\r
916 <dd>\r
917 <p>\r
918         Contains key/value pairs of colors. Each value is a color code in hex,\r
919         formatted #rrggbb (like in HTML).\r
920 </p>\r
921 </dd>\r
922 </dl></div>\r
923 <div class="paragraph"><p>The following colors can be configured at the moment:</p></div>\r
924 <div class="dlist"><dl>\r
925 <dt class="hdlist1">\r
926 background\r
927 </dt>\r
928 <dd>\r
929 <p>\r
930         Background color of the bar.\r
931 </p>\r
932 </dd>\r
933 <dt class="hdlist1">\r
934 statusline\r
935 </dt>\r
936 <dd>\r
937 <p>\r
938         Text color to be used for the statusline.\r
939 </p>\r
940 </dd>\r
941 <dt class="hdlist1">\r
942 separator\r
943 </dt>\r
944 <dd>\r
945 <p>\r
946         Text color to be used for the separator.\r
947 </p>\r
948 </dd>\r
949 <dt class="hdlist1">\r
950 focused_background\r
951 </dt>\r
952 <dd>\r
953 <p>\r
954         Background color of the bar on the currently focused monitor output.\r
955 </p>\r
956 </dd>\r
957 <dt class="hdlist1">\r
958 focused_statusline\r
959 </dt>\r
960 <dd>\r
961 <p>\r
962         Text color to be used for the statusline on the currently focused\r
963         monitor output.\r
964 </p>\r
965 </dd>\r
966 <dt class="hdlist1">\r
967 focused_separator\r
968 </dt>\r
969 <dd>\r
970 <p>\r
971         Text color to be used for the separator on the currently focused\r
972         monitor output.\r
973 </p>\r
974 </dd>\r
975 <dt class="hdlist1">\r
976 focused_workspace_text/focused_workspace_bg/focused_workspace_border\r
977 </dt>\r
978 <dd>\r
979 <p>\r
980         Text/background/border color for a workspace button when the workspace\r
981         has focus.\r
982 </p>\r
983 </dd>\r
984 <dt class="hdlist1">\r
985 active_workspace_text/active_workspace_bg/active_workspace_border\r
986 </dt>\r
987 <dd>\r
988 <p>\r
989         Text/background/border color for a workspace button when the workspace\r
990         is active (visible) on some output, but the focus is on another one.\r
991         You can only tell this apart from the focused workspace when you are\r
992         using multiple monitors.\r
993 </p>\r
994 </dd>\r
995 <dt class="hdlist1">\r
996 inactive_workspace_text/inactive_workspace_bg/inactive_workspace_border\r
997 </dt>\r
998 <dd>\r
999 <p>\r
1000         Text/background/border color for a workspace button when the workspace\r
1001         does not have focus and is not active (visible) on any output. This\r
1002         will be the case for most workspaces.\r
1003 </p>\r
1004 </dd>\r
1005 <dt class="hdlist1">\r
1006 urgent_workspace_text/urgent_workspace_bg/urgent_workspace_border\r
1007 </dt>\r
1008 <dd>\r
1009 <p>\r
1010         Text/background/border color for workspaces which contain at least one\r
1011         window with the urgency hint set.\r
1012 </p>\r
1013 </dd>\r
1014 <dt class="hdlist1">\r
1015 binding_mode_text/binding_mode_bg/binding_mode_border\r
1016 </dt>\r
1017 <dd>\r
1018 <p>\r
1019         Text/background/border color for the binding mode indicator.\r
1020 </p>\r
1021 </dd>\r
1022 </dl></div>\r
1023 <div class="paragraph"><p><strong>Example of configured bars:</strong></p></div>\r
1024 <div class="listingblock">\r
1025 <div class="content">\r
1026 <pre><tt>["bar-bxuqzf"]</tt></pre>\r
1027 </div></div>\r
1028 <div class="paragraph"><p><strong>Example of bar configuration:</strong></p></div>\r
1029 <div class="listingblock">\r
1030 <div class="content">\r
1031 <pre><tt>{\r
1032  "id": "bar-bxuqzf",\r
1033  "mode": "dock",\r
1034  "position": "bottom",\r
1035  "status_command": "i3status",\r
1036  "font": "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1",\r
1037  "workspace_buttons": true,\r
1038  "binding_mode_indicator": true,\r
1039  "verbose": false,\r
1040  "colors": {\r
1041    "background": "#c0c0c0",\r
1042    "statusline": "#00ff00",\r
1043    "focused_workspace_text": "#ffffff",\r
1044    "focused_workspace_bg": "#000000"\r
1045  }\r
1046 }</tt></pre>\r
1047 </div></div>\r
1048 </div>\r
1049 <div class="sect2">\r
1050 <h3 id="_version_reply">3.9. VERSION reply</h3>\r
1051 <div class="paragraph"><p>The reply consists of a single JSON dictionary with the following keys:</p></div>\r
1052 <div class="dlist"><dl>\r
1053 <dt class="hdlist1">\r
1054 major (integer)\r
1055 </dt>\r
1056 <dd>\r
1057 <p>\r
1058         The major version of i3, such as <tt>4</tt>.\r
1059 </p>\r
1060 </dd>\r
1061 <dt class="hdlist1">\r
1062 minor (integer)\r
1063 </dt>\r
1064 <dd>\r
1065 <p>\r
1066         The minor version of i3, such as <tt>2</tt>. Changes in the IPC interface (new\r
1067         features) will only occur with new minor (or major) releases. However,\r
1068         bugfixes might be introduced in patch releases, too.\r
1069 </p>\r
1070 </dd>\r
1071 <dt class="hdlist1">\r
1072 patch (integer)\r
1073 </dt>\r
1074 <dd>\r
1075 <p>\r
1076         The patch version of i3, such as <tt>1</tt> (when the complete version is\r
1077         <tt>4.2.1</tt>). For versions such as <tt>4.2</tt>, patch will be set to <tt>0</tt>.\r
1078 </p>\r
1079 </dd>\r
1080 <dt class="hdlist1">\r
1081 human_readable (string)\r
1082 </dt>\r
1083 <dd>\r
1084 <p>\r
1085         A human-readable version of i3 containing the precise git version,\r
1086         build date and branch name. When you need to display the i3 version to\r
1087         your users, use the human-readable version whenever possible (since\r
1088         this is what <tt>i3 --version</tt> displays, too).\r
1089 </p>\r
1090 </dd>\r
1091 <dt class="hdlist1">\r
1092 loaded_config_file_name (string)\r
1093 </dt>\r
1094 <dd>\r
1095 <p>\r
1096         The current config path.\r
1097 </p>\r
1098 </dd>\r
1099 </dl></div>\r
1100 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1101 <div class="listingblock">\r
1102 <div class="content">\r
1103 <pre><tt>{\r
1104    "human_readable" : "4.2-169-gf80b877 (2012-08-05, branch \"next\")",\r
1105    "loaded_config_file_name" : "/home/hwangcc23/.i3/config",\r
1106    "minor" : 2,\r
1107    "patch" : 0,\r
1108    "major" : 4\r
1109 }</tt></pre>\r
1110 </div></div>\r
1111 </div>\r
1112 </div>\r
1113 </div>\r
1114 <div class="sect1">\r
1115 <h2 id="_events">4. Events</h2>\r
1116 <div class="sectionbody">\r
1117 <div class="paragraph" id="events"><p>To get informed when certain things happen in i3, clients can subscribe to\r
1118 events. Events consist of a name (like "workspace") and an event reply type\r
1119 (like I3_IPC_EVENT_WORKSPACE). The events sent by i3 are in the same format\r
1120 as replies to specific commands. However, the highest bit of the message type\r
1121 is set to 1 to indicate that this is an event reply instead of a normal reply.</p></div>\r
1122 <div class="paragraph"><p>Caveat: As soon as you subscribe to an event, it is not guaranteed any longer\r
1123 that the requests to i3 are processed in order. This means, the following\r
1124 situation can happen: You send a GET_WORKSPACES request but you receive a\r
1125 "workspace" event before receiving the reply to GET_WORKSPACES. If your\r
1126 program does not want to cope which such kinds of race conditions (an\r
1127 event based library may not have a problem here), I suggest you create a\r
1128 separate connection to receive events.</p></div>\r
1129 <div class="sect2">\r
1130 <h3 id="_subscribing_to_events">4.1. Subscribing to events</h3>\r
1131 <div class="paragraph"><p>By sending a message of type SUBSCRIBE with a JSON-encoded array as payload\r
1132 you can register to an event.</p></div>\r
1133 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1134 <div class="listingblock">\r
1135 <div class="content">\r
1136 <pre><tt>type: SUBSCRIBE\r
1137 payload: [ "workspace", "output" ]</tt></pre>\r
1138 </div></div>\r
1139 </div>\r
1140 <div class="sect2">\r
1141 <h3 id="_available_events">4.2. Available events</h3>\r
1142 <div class="paragraph"><p>The numbers in parenthesis is the event type (keep in mind that you need to\r
1143 strip the highest bit first).</p></div>\r
1144 <div class="dlist"><dl>\r
1145 <dt class="hdlist1">\r
1146 workspace (0)\r
1147 </dt>\r
1148 <dd>\r
1149 <p>\r
1150         Sent when the user switches to a different workspace, when a new\r
1151         workspace is initialized or when a workspace is removed (because the\r
1152         last client vanished).\r
1153 </p>\r
1154 </dd>\r
1155 <dt class="hdlist1">\r
1156 output (1)\r
1157 </dt>\r
1158 <dd>\r
1159 <p>\r
1160         Sent when RandR issues a change notification (of either screens,\r
1161         outputs, CRTCs or output properties).\r
1162 </p>\r
1163 </dd>\r
1164 <dt class="hdlist1">\r
1165 mode (2)\r
1166 </dt>\r
1167 <dd>\r
1168 <p>\r
1169         Sent whenever i3 changes its binding mode.\r
1170 </p>\r
1171 </dd>\r
1172 <dt class="hdlist1">\r
1173 window (3)\r
1174 </dt>\r
1175 <dd>\r
1176 <p>\r
1177         Sent when a client&#8217;s window is successfully reparented (that is when i3\r
1178         has finished fitting it into a container), when a window received input\r
1179         focus or when certain properties of the window have changed.\r
1180 </p>\r
1181 </dd>\r
1182 <dt class="hdlist1">\r
1183 barconfig_update (4)\r
1184 </dt>\r
1185 <dd>\r
1186 <p>\r
1187     Sent when the hidden_state or mode field in the barconfig of any bar\r
1188     instance was updated and when the config is reloaded.\r
1189 </p>\r
1190 </dd>\r
1191 <dt class="hdlist1">\r
1192 binding (5)\r
1193 </dt>\r
1194 <dd>\r
1195 <p>\r
1196         Sent when a configured command binding is triggered with the keyboard or\r
1197         mouse\r
1198 </p>\r
1199 </dd>\r
1200 </dl></div>\r
1201 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1202 <div class="listingblock">\r
1203 <div class="content">\r
1204 <pre><tt># the appropriate 4 bytes read from the socket are stored in $input\r
1205 \r
1206 # unpack a 32-bit unsigned integer\r
1207 my $message_type = unpack("L", $input);\r
1208 \r
1209 # check if the highest bit is 1\r
1210 my $is_event = (($message_type &gt;&gt; 31) == 1);\r
1211 \r
1212 # use the other bits\r
1213 my $event_type = ($message_type &amp; 0x7F);\r
1214 \r
1215 if ($is_event) {\r
1216   say "Received event of type $event_type";\r
1217 }</tt></pre>\r
1218 </div></div>\r
1219 </div>\r
1220 <div class="sect2">\r
1221 <h3 id="_workspace_event">4.3. workspace event</h3>\r
1222 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
1223 <tt>change (string)</tt> which indicates the type of the change ("focus", "init",\r
1224 "empty", "urgent"). A <tt>current (object)</tt> property will be present with the\r
1225 affected workspace whenever the type of event affects a workspace (otherwise,\r
1226 it will be +null).</p></div>\r
1227 <div class="paragraph"><p>When the change is "focus", an <tt>old (object)</tt> property will be present with the\r
1228 previous workspace.  When the first switch occurs (when i3 focuses the\r
1229 workspace visible at the beginning) there is no previous workspace, and the\r
1230 <tt>old</tt> property will be set to <tt>null</tt>.  Also note that if the previous is empty\r
1231 it will get destroyed when switching, but will still be present in the "old"\r
1232 property.</p></div>\r
1233 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1234 <div class="listingblock">\r
1235 <div class="content">\r
1236 <pre><tt>{\r
1237  "change": "focus",\r
1238  "current": {\r
1239   "id": 28489712,\r
1240   "type": "workspace",\r
1241   ...\r
1242  }\r
1243  "old": {\r
1244   "id": 28489715,\r
1245   "type": "workspace",\r
1246   ...\r
1247  }\r
1248 }</tt></pre>\r
1249 </div></div>\r
1250 </div>\r
1251 <div class="sect2">\r
1252 <h3 id="_output_event">4.4. output event</h3>\r
1253 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
1254 <tt>change (string)</tt> which indicates the type of the change (currently only\r
1255 "unspecified").</p></div>\r
1256 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1257 <div class="listingblock">\r
1258 <div class="content">\r
1259 <pre><tt>{ "change": "unspecified" }</tt></pre>\r
1260 </div></div>\r
1261 </div>\r
1262 <div class="sect2">\r
1263 <h3 id="_mode_event">4.5. mode event</h3>\r
1264 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
1265 <tt>change (string)</tt> which holds the name of current mode in use. The name\r
1266 is the same as specified in config when creating a mode. The default\r
1267 mode is simply named default. It contains a second property, <tt>pango_markup</tt>, which\r
1268 defines whether pango markup shall be used for displaying this mode.</p></div>\r
1269 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1270 <div class="listingblock">\r
1271 <div class="content">\r
1272 <pre><tt>{\r
1273   "change": "default",\r
1274   "pango_markup": true\r
1275 }</tt></pre>\r
1276 </div></div>\r
1277 </div>\r
1278 <div class="sect2">\r
1279 <h3 id="_window_event">4.6. window event</h3>\r
1280 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
1281 <tt>change (string)</tt> which indicates the type of the change</p></div>\r
1282 <div class="ulist"><ul>\r
1283 <li>\r
1284 <p>\r
1285 <tt>new</tt> - the window has become managed by i3\r
1286 </p>\r
1287 </li>\r
1288 <li>\r
1289 <p>\r
1290 <tt>close</tt> - the window has closed\r
1291 </p>\r
1292 </li>\r
1293 <li>\r
1294 <p>\r
1295 <tt>focus</tt> - the window has received input focus\r
1296 </p>\r
1297 </li>\r
1298 <li>\r
1299 <p>\r
1300 <tt>title</tt> - the window&#8217;s title has changed\r
1301 </p>\r
1302 </li>\r
1303 <li>\r
1304 <p>\r
1305 <tt>fullscreen_mode</tt> - the window has entered or exited fullscreen mode\r
1306 </p>\r
1307 </li>\r
1308 <li>\r
1309 <p>\r
1310 <tt>move</tt> - the window has changed its position in the tree\r
1311 </p>\r
1312 </li>\r
1313 <li>\r
1314 <p>\r
1315 <tt>floating</tt> - the window has transitioned to or from floating\r
1316 </p>\r
1317 </li>\r
1318 <li>\r
1319 <p>\r
1320 <tt>urgent</tt> - the window has become urgent or lost its urgent status\r
1321 </p>\r
1322 </li>\r
1323 </ul></div>\r
1324 <div class="paragraph"><p>Additionally a <tt>container (object)</tt> field will be present, which consists\r
1325 of the window&#8217;s parent container. Be aware that for the "new" event, the\r
1326 container will hold the initial name of the newly reparented window (e.g.\r
1327 if you run urxvt with a shell that changes the title, you will still at\r
1328 this point get the window title as "urxvt").</p></div>\r
1329 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1330 <div class="listingblock">\r
1331 <div class="content">\r
1332 <pre><tt>{\r
1333  "change": "new",\r
1334  "container": {\r
1335   "id": 35569536,\r
1336   "type": "con",\r
1337   ...\r
1338  }\r
1339 }</tt></pre>\r
1340 </div></div>\r
1341 </div>\r
1342 <div class="sect2">\r
1343 <h3 id="_barconfig_update_event">4.7. barconfig_update event</h3>\r
1344 <div class="paragraph"><p>This event consists of a single serialized map reporting on options from the\r
1345 barconfig of the specified bar_id that were updated in i3. This event is the\r
1346 same as a <tt>GET_BAR_CONFIG</tt> reply for the bar with the given id.</p></div>\r
1347 </div>\r
1348 <div class="sect2">\r
1349 <h3 id="_binding_event">4.8. binding event</h3>\r
1350 <div class="paragraph"><p>This event consists of a single serialized map reporting on the details of a\r
1351 binding that ran a command because of user input. The <tt>change (sring)</tt> field\r
1352 indicates what sort of binding event was triggered (right now it will always be\r
1353 <tt>"run"</tt> but may be expanded in the future).</p></div>\r
1354 <div class="paragraph"><p>The <tt>binding (object)</tt> field contains details about the binding that was run:</p></div>\r
1355 <div class="dlist"><dl>\r
1356 <dt class="hdlist1">\r
1357 command (string)\r
1358 </dt>\r
1359 <dd>\r
1360 <p>\r
1361         The i3 command that is configured to run for this binding.\r
1362 </p>\r
1363 </dd>\r
1364 <dt class="hdlist1">\r
1365 event_state_mask (array of strings)\r
1366 </dt>\r
1367 <dd>\r
1368 <p>\r
1369         The group and modifier keys that were configured with this binding.\r
1370 </p>\r
1371 </dd>\r
1372 <dt class="hdlist1">\r
1373 input_code (integer)\r
1374 </dt>\r
1375 <dd>\r
1376 <p>\r
1377         If the binding was configured with <tt>bindcode</tt>, this will be the key code\r
1378         that was given for the binding. If the binding is a mouse binding, it will be\r
1379         the number of the mouse button that was pressed. Otherwise it will be 0.\r
1380 </p>\r
1381 </dd>\r
1382 <dt class="hdlist1">\r
1383 symbol (string or null)\r
1384 </dt>\r
1385 <dd>\r
1386 <p>\r
1387         If this is a keyboard binding that was configured with <tt>bindsym</tt>, this\r
1388         field will contain the given symbol. Otherwise it will be <tt>null</tt>.\r
1389 </p>\r
1390 </dd>\r
1391 <dt class="hdlist1">\r
1392 input_type (string)\r
1393 </dt>\r
1394 <dd>\r
1395 <p>\r
1396         This will be <tt>"keyboard"</tt> or <tt>"mouse"</tt> depending on whether or not this was\r
1397         a keyboard or a mouse binding.\r
1398 </p>\r
1399 </dd>\r
1400 </dl></div>\r
1401 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
1402 <div class="listingblock">\r
1403 <div class="content">\r
1404 <pre><tt>{\r
1405  "change": "run",\r
1406  "binding": {\r
1407   "command": "nop",\r
1408   "event_state_mask": [\r
1409     "shift",\r
1410     "ctrl"\r
1411   ],\r
1412   "input_code": 0,\r
1413   "symbol": "t",\r
1414   "input_type": "keyboard"\r
1415  }\r
1416 }</tt></pre>\r
1417 </div></div>\r
1418 </div>\r
1419 </div>\r
1420 </div>\r
1421 <div class="sect1">\r
1422 <h2 id="_see_also_existing_libraries">5. See also (existing libraries)</h2>\r
1423 <div class="sectionbody">\r
1424 <div class="paragraph" id="libraries"><p>For some languages, libraries are available (so you don’t have to implement\r
1425 all this on your own). This list names some (if you wrote one, please let me\r
1426 know):</p></div>\r
1427 <div class="dlist"><dl>\r
1428 <dt class="hdlist1">\r
1429 C\r
1430 </dt>\r
1431 <dd>\r
1432 <div class="ulist"><ul>\r
1433 <li>\r
1434 <p>\r
1435 i3 includes a headerfile <tt>i3/ipc.h</tt> which provides you all constants.\r
1436 </p>\r
1437 </li>\r
1438 <li>\r
1439 <p>\r
1440 <a href="https://github.com/acrisci/i3ipc-glib">https://github.com/acrisci/i3ipc-glib</a>\r
1441 </p>\r
1442 </li>\r
1443 </ul></div>\r
1444 </dd>\r
1445 <dt class="hdlist1">\r
1446 C++\r
1447 </dt>\r
1448 <dd>\r
1449 <div class="ulist"><ul>\r
1450 <li>\r
1451 <p>\r
1452 <a href="https://github.com/drmgc/i3ipcpp">https://github.com/drmgc/i3ipcpp</a>\r
1453 </p>\r
1454 </li>\r
1455 </ul></div>\r
1456 </dd>\r
1457 <dt class="hdlist1">\r
1458 Go\r
1459 </dt>\r
1460 <dd>\r
1461 <div class="ulist"><ul>\r
1462 <li>\r
1463 <p>\r
1464 <a href="https://github.com/proxypoke/i3ipc">https://github.com/proxypoke/i3ipc</a>\r
1465 </p>\r
1466 </li>\r
1467 </ul></div>\r
1468 </dd>\r
1469 <dt class="hdlist1">\r
1470 JavaScript\r
1471 </dt>\r
1472 <dd>\r
1473 <div class="ulist"><ul>\r
1474 <li>\r
1475 <p>\r
1476 <a href="https://github.com/acrisci/i3ipc-gjs">https://github.com/acrisci/i3ipc-gjs</a>\r
1477 </p>\r
1478 </li>\r
1479 </ul></div>\r
1480 </dd>\r
1481 <dt class="hdlist1">\r
1482 Lua\r
1483 </dt>\r
1484 <dd>\r
1485 <div class="ulist"><ul>\r
1486 <li>\r
1487 <p>\r
1488 <a href="https://github.com/acrisci/i3ipc-lua">https://github.com/acrisci/i3ipc-lua</a>\r
1489 </p>\r
1490 </li>\r
1491 </ul></div>\r
1492 </dd>\r
1493 <dt class="hdlist1">\r
1494 Perl\r
1495 </dt>\r
1496 <dd>\r
1497 <div class="ulist"><ul>\r
1498 <li>\r
1499 <p>\r
1500 <a href="https://metacpan.org/module/AnyEvent::I3">https://metacpan.org/module/AnyEvent::I3</a>\r
1501 </p>\r
1502 </li>\r
1503 </ul></div>\r
1504 </dd>\r
1505 <dt class="hdlist1">\r
1506 Python\r
1507 </dt>\r
1508 <dd>\r
1509 <div class="ulist"><ul>\r
1510 <li>\r
1511 <p>\r
1512 <a href="https://github.com/acrisci/i3ipc-python">https://github.com/acrisci/i3ipc-python</a>\r
1513 </p>\r
1514 </li>\r
1515 <li>\r
1516 <p>\r
1517 <a href="https://github.com/whitelynx/i3ipc">https://github.com/whitelynx/i3ipc</a> (not maintained)\r
1518 </p>\r
1519 </li>\r
1520 <li>\r
1521 <p>\r
1522 <a href="https://github.com/ziberna/i3-py">https://github.com/ziberna/i3-py</a> (not maintained)\r
1523 </p>\r
1524 </li>\r
1525 </ul></div>\r
1526 </dd>\r
1527 <dt class="hdlist1">\r
1528 Ruby\r
1529 </dt>\r
1530 <dd>\r
1531 <div class="ulist"><ul>\r
1532 <li>\r
1533 <p>\r
1534 <a href="https://github.com/veelenga/i3ipc-ruby">https://github.com/veelenga/i3ipc-ruby</a>\r
1535 </p>\r
1536 </li>\r
1537 <li>\r
1538 <p>\r
1539 <a href="https://github.com/badboy/i3-ipc">https://github.com/badboy/i3-ipc</a> (not maintained)\r
1540 </p>\r
1541 </li>\r
1542 </ul></div>\r
1543 </dd>\r
1544 <dt class="hdlist1">\r
1545 Rust\r
1546 </dt>\r
1547 <dd>\r
1548 <div class="ulist"><ul>\r
1549 <li>\r
1550 <p>\r
1551 <a href="https://github.com/tmerr/i3ipc-rs">https://github.com/tmerr/i3ipc-rs</a>\r
1552 </p>\r
1553 </li>\r
1554 </ul></div>\r
1555 </dd>\r
1556 </dl></div>\r
1557 </div>\r
1558 </div>\r
1559 </div>\r
1560 <div id="footnotes"><hr /></div>\r
1561 <div id="footer" lang="de">\r
1562 © 2009-2011 Michael Stapelberg, <a href="/impress.html">Impressum</a>\r
1563 </div>\r
1564 </body>\r
1565 </html>\r