]> git.sur5r.net Git - i3/i3.github.io/blobdiff - docs/ipc.html
fix identation and typos
[i3/i3.github.io] / docs / ipc.html
index 4b20c01ca672a4d7ac187610cc1835bc0e1fc84f..1771a14660e37b92a924d4f8503fe96082c30cd7 100644 (file)
@@ -4,13 +4,13 @@
 <head>\r
 <link rel="icon" type="image/png" href="/favicon.png">\r
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
 <head>\r
 <link rel="icon" type="image/png" href="/favicon.png">\r
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.7" />\r
+<meta name="generator" content="AsciiDoc 8.6.9" />\r
 <title>i3: IPC interface (interprocess communication)</title>\r
 <link rel="stylesheet" href="/css/style.css" type="text/css" />\r
 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
 <script type="text/javascript">\r
 /*<![CDATA[*/\r
 <title>i3: IPC interface (interprocess communication)</title>\r
 <link rel="stylesheet" href="/css/style.css" type="text/css" />\r
 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
 <script type="text/javascript">\r
 /*<![CDATA[*/\r
-window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}\r
+document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); asciidoc.toc(2);}, false);\r
 /*]]>*/\r
 </script>\r
 <script type="text/javascript" src="/js/asciidoc-xhtml11.js"></script>\r
 /*]]>*/\r
 </script>\r
 <script type="text/javascript" src="/js/asciidoc-xhtml11.js"></script>\r
@@ -31,7 +31,7 @@ window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}
 <h1>IPC interface (interprocess communication)</h1>\r
 <span id="author">Michael Stapelberg</span><br />\r
 <span id="email"><tt>&lt;<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>&gt;</tt></span><br />\r
 <h1>IPC interface (interprocess communication)</h1>\r
 <span id="author">Michael Stapelberg</span><br />\r
 <span id="email"><tt>&lt;<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>&gt;</tt></span><br />\r
-<span id="revdate">August 2012</span>\r
+<span id="revdate">February 2014</span>\r
 <div id="toc">
   <div id="toctitle">Table of Contents</div>
   <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
 <div id="toc">
   <div id="toctitle">Table of Contents</div>
   <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
@@ -52,6 +52,18 @@ filename character set (see mkdtemp(3)). You can get the socketpath from i3 by
 calling <tt>i3 --get-socketpath</tt>.</p></div>\r
 <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
 X11 property, stored on the X11 root window.</p></div>\r
 calling <tt>i3 --get-socketpath</tt>.</p></div>\r
 <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
 X11 property, stored on the X11 root window.</p></div>\r
+<div class="admonitionblock">\r
+<table><tr>\r
+<td class="icon">\r
+<div class="title">Warning</div>\r
+</td>\r
+<td class="content">\r
+<div class="title">Use an existing library!</div>There are existing libraries for many languages. You can have a look at\r
+<a href="#libraries">[libraries]</a> or search the web if your language of choice is not mentioned.\r
+Usually, it is not necessary to implement low-level communication with i3\r
+directly.</td>\r
+</tr></table>\r
+</div>\r
 </div>\r
 </div>\r
 <div class="sect1">\r
 </div>\r
 </div>\r
 <div class="sect1">\r
@@ -167,7 +179,7 @@ GET_VERSION (7)
 <div class="listingblock">\r
 <div class="content">\r
 <pre><tt>00000000  69 33 2d 69 70 63 04 00  00 00 00 00 00 00 65 78  |i3-ipc........ex|\r
 <div class="listingblock">\r
 <div class="content">\r
 <pre><tt>00000000  69 33 2d 69 70 63 04 00  00 00 00 00 00 00 65 78  |i3-ipc........ex|\r
-00000010  69 74 0a                                          |it.|</tt></pre>\r
+00000010  69 74                                             |it|</tt></pre>\r
 </div></div>\r
 <div class="paragraph"><p>To generate and send such a message, you could use the following code in Perl:</p></div>\r
 <div class="listingblock">\r
 </div></div>\r
 <div class="paragraph"><p>To generate and send such a message, you could use the following code in Perl:</p></div>\r
 <div class="listingblock">\r
@@ -267,12 +279,13 @@ VERSION (7)
 </div>\r
 <div class="sect2">\r
 <h3 id="_command_reply">3.2. COMMAND reply</h3>\r
 </div>\r
 <div class="sect2">\r
 <h3 id="_command_reply">3.2. COMMAND reply</h3>\r
-<div class="paragraph"><p>The reply consists of a single serialized map. At the moment, the only\r
-property is <tt>success (bool)</tt>, but this will be expanded in future versions.</p></div>\r
+<div class="paragraph"><p>The reply consists of a list of serialized maps for each command that was\r
+parsed. Each has the property <tt>success (bool)</tt> and may also include a\r
+human-readable error message in the property <tt>error (string)</tt>.</p></div>\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
 <div class="content">\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
 <div class="content">\r
-<pre><tt>{ "success": true }</tt></pre>\r
+<pre><tt>[{ "success": true }]</tt></pre>\r
 </div></div>\r
 </div>\r
 <div class="sect2">\r
 </div></div>\r
 </div>\r
 <div class="sect2">\r
@@ -410,12 +423,12 @@ active (boolean)
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
-current_workspace (integer)\r
+current_workspace (string)\r
 </dt>\r
 <dd>\r
 <p>\r
 </dt>\r
 <dd>\r
 <p>\r
-        The current workspace which is visible on this output. <tt>null</tt> if the\r
-        output is not active.\r
+        The name of the current workspace that is visible on this output. <tt>null</tt> if\r
+        the output is not active.\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
@@ -435,7 +448,7 @@ rect (map)
  {\r
   "name": "LVDS1",\r
   "active": true,\r
  {\r
   "name": "LVDS1",\r
   "active": true,\r
-  "current_workspace": 4,\r
+  "current_workspace": "4",\r
   "rect": {\r
    "x": 0,\r
    "y": 0,\r
   "rect": {\r
    "x": 0,\r
    "y": 0,\r
@@ -446,7 +459,7 @@ rect (map)
  {\r
   "name": "VGA1",\r
   "active": true,\r
  {\r
   "name": "VGA1",\r
   "active": true,\r
-  "current_workspace": 1,\r
+  "current_workspace": "1",\r
   "rect": {\r
    "x": 1280,\r
    "y": 0,\r
   "rect": {\r
    "x": 1280,\r
    "y": 0,\r
@@ -482,10 +495,21 @@ name (string)
         The internal name of this container. For all containers which are part\r
         of the tree structure down to the workspace contents, this is set to a\r
         nice human-readable name of the container.\r
         The internal name of this container. For all containers which are part\r
         of the tree structure down to the workspace contents, this is set to a\r
         nice human-readable name of the container.\r
+        For containers that have an X11 window, the content is the title\r
+        (_NET_WM_NAME property) of that window.\r
         For all other containers, the content is not defined (yet).\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
         For all other containers, the content is not defined (yet).\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+type (string)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Type of this container. Can be one of "root", "output", "con",\r
+        "floating_con", "workspace" or "dockarea".\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 border (string)\r
 </dt>\r
 <dd>\r
 border (string)\r
 </dt>\r
 <dd>\r
@@ -495,6 +519,14 @@ border (string)
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+current_border_width (integer)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Number of pixels of the border width.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 layout (string)\r
 </dt>\r
 <dd>\r
 layout (string)\r
 </dt>\r
 <dd>\r
@@ -769,9 +801,8 @@ VGA1
 <div class="sect2">\r
 <h3 id="_marks_reply">3.7. MARKS reply</h3>\r
 <div class="paragraph"><p>The reply consists of a single array of strings for each container that has a\r
 <div class="sect2">\r
 <h3 id="_marks_reply">3.7. MARKS reply</h3>\r
 <div class="paragraph"><p>The reply consists of a single array of strings for each container that has a\r
-mark. The order of that array is undefined. If more than one container has the\r
-same mark, it will be represented multiple times in the reply (the array\r
-contents are not unique).</p></div>\r
+mark. A mark can only be set on one container, so the array is unique.\r
+The order of that array is undefined.</p></div>\r
 <div class="paragraph"><p>If no window has a mark the response will be the empty array [].</p></div>\r
 </div>\r
 <div class="sect2">\r
 <div class="paragraph"><p>If no window has a mark the response will be the empty array [].</p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -853,6 +884,14 @@ workspace_buttons (boolean)
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+binding_mode_indicator (boolean)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Display the mode indicator or not? Defaults to true.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 verbose (boolean)\r
 </dt>\r
 <dd>\r
 verbose (boolean)\r
 </dt>\r
 <dd>\r
@@ -889,6 +928,14 @@ statusline
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+separator\r
+</dt>\r
+<dd>\r
+<p>\r
+        Text color to be used for the separator.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 focused_workspace_text/focused_workspace_bg\r
 </dt>\r
 <dd>\r
 focused_workspace_text/focused_workspace_bg\r
 </dt>\r
 <dd>\r
@@ -943,6 +990,7 @@ urgent_workspace_text/urgent_workspace_bar
  "status_command": "i3status",\r
  "font": "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1",\r
  "workspace_buttons": true,\r
  "status_command": "i3status",\r
  "font": "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1",\r
  "workspace_buttons": true,\r
+ "binding_mode_indicator": true,\r
  "verbose": false,\r
  "colors": {\r
    "background": "#c0c0c0",\r
  "verbose": false,\r
  "colors": {\r
    "background": "#c0c0c0",\r
@@ -1059,6 +1107,33 @@ output (1)
         outputs, CRTCs or output properties).\r
 </p>\r
 </dd>\r
         outputs, CRTCs or output properties).\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+mode (2)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Sent whenever i3 changes its binding mode.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+window (3)\r
+</dt>\r
+<dd>\r
+<p>\r
+        Sent when a client&#8217;s window is successfully reparented (that is when i3\r
+        has finished fitting it into a container), when a window received input\r
+        focus or when certain properties of the window have changed.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+barconfig_update (4)\r
+</dt>\r
+<dd>\r
+<p>\r
+    Sent when the hidden_state or mode field in the barconfig of any bar\r
+    instance was updated and when the config is reloaded.\r
+</p>\r
+</dd>\r
 </dl></div>\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
 </dl></div>\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
@@ -1084,10 +1159,29 @@ if ($is_event) {
 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
 <tt>change (string)</tt> which indicates the type of the change ("focus", "init",\r
 "empty", "urgent").</p></div>\r
 <div class="paragraph"><p>This event consists of a single serialized map containing a property\r
 <tt>change (string)</tt> which indicates the type of the change ("focus", "init",\r
 "empty", "urgent").</p></div>\r
+<div class="paragraph"><p>Moreover, when the change is "focus", an <tt>old (object)</tt> and a <tt>current\r
+(object)</tt> properties will be present with the previous and current\r
+workspace respectively.  When the first switch occurs (when i3 focuses\r
+the workspace visible at the beginning) there is no previous\r
+workspace, and the <tt>old</tt> property will be set to <tt>null</tt>.  Also note\r
+that if the previous is empty it will get destroyed when switching,\r
+but will still be present in the "old" property.</p></div>\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
 <div class="content">\r
 <div class="paragraph"><p><strong>Example:</strong></p></div>\r
 <div class="listingblock">\r
 <div class="content">\r
-<pre><tt>{ "change": "focus" }</tt></pre>\r
+<pre><tt>{\r
+ "change": "focus",\r
+ "current": {\r
+  "id": 28489712,\r
+  "type": "workspace",\r
+  ...\r
+ }\r
+ "old": {\r
+  "id": 28489715,\r
+  "type": "workspace",\r
+  ...\r
+ }\r
+}</tt></pre>\r
 </div></div>\r
 </div>\r
 <div class="sect2">\r
 </div></div>\r
 </div>\r
 <div class="sect2">\r
@@ -1101,56 +1195,102 @@ if ($is_event) {
 <pre><tt>{ "change": "unspecified" }</tt></pre>\r
 </div></div>\r
 </div>\r
 <pre><tt>{ "change": "unspecified" }</tt></pre>\r
 </div></div>\r
 </div>\r
+<div class="sect2">\r
+<h3 id="_mode_event">4.5. mode event</h3>\r
+<div class="paragraph"><p>This event consists of a single serialized map containing a property\r
+<tt>change (string)</tt> which holds the name of current mode in use. The name\r
+is the same as specified in config when creating a mode. The default\r
+mode is simply named default.</p></div>\r
+<div class="paragraph"><p><strong>Example:</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{ "change": "default" }</tt></pre>\r
+</div></div>\r
 </div>\r
 </div>\r
-</div>\r
-<div class="sect1">\r
-<h2 id="_see_also">5. See also</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>For some languages, libraries are available (so you don’t have to implement\r
-all this on your own). This list names some (if you wrote one, please let me\r
-know):</p></div>\r
-<div class="dlist"><dl>\r
-<dt class="hdlist1">\r
-C\r
-</dt>\r
-<dd>\r
-<p>\r
-        i3 includes a headerfile <tt>i3/ipc.h</tt> which provides you all constants.\r
-        However, there is no library yet.\r
-</p>\r
-</dd>\r
-<dt class="hdlist1">\r
-Ruby\r
-</dt>\r
-<dd>\r
+<div class="sect2">\r
+<h3 id="_window_event">4.6. window event</h3>\r
+<div class="paragraph"><p>This event consists of a single serialized map containing a property\r
+<tt>change (string)</tt> which indicates the type of the change</p></div>\r
+<div class="ulist"><ul>\r
+<li>\r
 <p>\r
 <p>\r
-        <a href="http://github.com/badboy/i3-ipc">http://github.com/badboy/i3-ipc</a>\r
+<tt>new</tt> - the window has become managed by i3\r
 </p>\r
 </p>\r
-</dd>\r
-<dt class="hdlist1">\r
-Perl\r
-</dt>\r
-<dd>\r
+</li>\r
+<li>\r
 <p>\r
 <p>\r
-        <a href="https://metacpan.org/module/AnyEvent::I3">https://metacpan.org/module/AnyEvent::I3</a>\r
+<tt>focus</tt> - the window has received input focus\r
 </p>\r
 </p>\r
-</dd>\r
-<dt class="hdlist1">\r
-Python\r
-</dt>\r
-<dd>\r
-<div class="ulist"><ul>\r
+</li>\r
 <li>\r
 <p>\r
 <li>\r
 <p>\r
-<a href="https://github.com/whitelynx/i3ipc">https://github.com/whitelynx/i3ipc</a>\r
+<tt>title</tt> - the window&#8217;s title has changed\r
 </p>\r
 </li>\r
 <li>\r
 <p>\r
 </p>\r
 </li>\r
 <li>\r
 <p>\r
-<a href="https://github.com/ziberna/i3-py">https://github.com/ziberna/i3-py</a> (includes higher-level features)\r
+<tt>fullscreen_mode</tt> - the window has entered or exited fullscreen mode\r
 </p>\r
 </li>\r
 </ul></div>\r
 </p>\r
 </li>\r
 </ul></div>\r
+<div class="paragraph"><p>Additionally a <tt>container (object)</tt> field will be present, which consists\r
+of the window&#8217;s parent container. Be aware that for the "new" event, the\r
+container will hold the initial name of the newly reparented window (e.g.\r
+if you run urxvt with a shell that changes the title, you will still at\r
+this point get the window title as "urxvt").</p></div>\r
+<div class="paragraph"><p><strong>Example:</strong></p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>{\r
+ "change": "new",\r
+ "container": {\r
+  "id": 35569536,\r
+  "type": "con",\r
+  ...\r
+ }\r
+}</tt></pre>\r
+</div></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_barconfig_update_event">4.7. barconfig_update event</h3>\r
+<div class="paragraph"><p>This event consists of a single serialized map reporting on options from the\r
+barconfig of the specified bar_id that were updated in i3. This event is the\r
+same as a <tt>GET_BAR_CONFIG</tt> reply for the bar with the given id.</p></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_see_also_existing_libraries">5. See also (existing libraries)</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph" id="libraries"><p>For some languages, libraries are available (so you don’t have to implement\r
+all this on your own). This list names some (if you wrote one, please let me\r
+know):</p></div>\r
+<div class="dlist"><dl>\r
+<dt class="hdlist1">\r
+C\r
+</dt>\r
+<dd>\r
+<p>\r
+        i3 includes a headerfile <tt>i3/ipc.h</tt> which provides you all constants.\r
+</p>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><tt>        https://github.com/acrisci/i3ipc-glib\r
+Go::\r
+        * https://github.com/proxypoke/i3ipc\r
+JavaScript::\r
+        * https://github.com/acrisci/i3ipc-gjs\r
+Lua::\r
+        * https:/github.com/acrisci/i3ipc-lua\r
+Perl::\r
+        * https://metacpan.org/module/AnyEvent::I3\r
+Python::\r
+        * https://github.com/acrisci/i3ipc-python\r
+        * https://github.com/whitelynx/i3ipc (not maintained)\r
+        * https://github.com/ziberna/i3-py (not maintained)\r
+Ruby::\r
+        http://github.com/badboy/i3-ipc</tt></pre>\r
+</div></div>\r
 </dd>\r
 </dl></div>\r
 </div>\r
 </dd>\r
 </dl></div>\r
 </div>\r