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