<head>\r
<link rel="icon" type="image/x-icon" href="/favicon.ico">\r
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.8" />\r
+<meta name="generator" content="AsciiDoc 8.6.10" />\r
<title>i3: Layout saving in i3</title>\r
<link rel="stylesheet" href="/css/style.css" type="text/css" />\r
<link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
<ul id="nav">\r
<li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>\r
<li><a href="/screenshots">Screens</a></li>\r
- <li><a href="https://faq.i3wm.org/">FAQ</a></li>\r
+ <li><a href="https://www.reddit.com/r/i3wm/">FAQ</a></li>\r
<li><a href="/contact">Contact</a></li>\r
<li><a href="https://github.com/i3/i3/issues">Bugs</a></li>\r
</ul>\r
<span id="author">Michael Stapelberg</span><br />\r
<span id="email"><tt><<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>></tt></span><br />\r
<span id="revdate">April 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">\r
+ <div id="toctitle">Table of Contents</div>\r
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>\r
</div>\r
</div>\r
<div id="preamble">\r
<strong>swallowed</strong> by the placeholder container, hence the term.</p></div>\r
<div class="paragraph"><p>Note: Swallowing windows into unsatisfied placeholder windows takes precedence\r
over\r
-<a href="http://i3wm.org/docs/userguide.html#_automatically_putting_clients_on_specific_workspaces">assignment\r
+<a href="https://i3wm.org/docs/userguide.html#_automatically_putting_clients_on_specific_workspaces">assignment\r
rules</a>. For example, if you assign all Emacs windows to workspace 1 in your i3\r
configuration file, but there is a placeholder window on workspace 2 which\r
matches Emacs as well, your newly started Emacs window will end up in the\r
</a>\r
</span></p></div>\r
<div class="paragraph"><p>The structure of this JSON file looks a lot like the <tt>TREE</tt> reply, see\r
-<a href="http://build.i3wm.org/docs/ipc.html#_tree_reply">http://build.i3wm.org/docs/ipc.html#_tree_reply</a> for documentation on that. Some\r
+<a href="https://build.i3wm.org/docs/ipc.html#_tree_reply">https://build.i3wm.org/docs/ipc.html#_tree_reply</a> for documentation on that. Some\r
properties are excluded because they are not relevant when restoring a layout.</p></div>\r
<div class="paragraph"><p>Most importantly, look at the "swallows" section of each window. This is where\r
you need to be more or less specific. As an example, remember the section about\r
<div class="olist arabic"><ol class="arabic">\r
<li>\r
<p>\r
-Layout files contain multiple “JSON documents” on the top level, whereas the\r
- JSON standard only allows precisely one “document” (array or hash).\r
+Layout files contain multiple “JSON texts” at the top level. The JSON\r
+ standard doesn’t prohibit this, but in practice most JSON parsers only\r
+ allow precisely one “text” per document/file, and will mark multiple texts\r
+ as invalid JSON.\r
</p>\r
</li>\r
<li>\r
<p>\r
-Layout files contain comments which are not standardized, but understood by\r
- many parsers.\r
+Layout files contain comments which are not allowed by the JSON standard,\r
+ but are understood by many parsers.\r
</p>\r
</li>\r
</ol></div>\r
-<div class="paragraph"><p>Both deviations from the JSON standard are to make manual editing by humans\r
+<div class="paragraph"><p>Both of these deviations from the norm are to make manual editing by humans\r
easier. In case you are writing a more elaborate tool for manipulating these\r
layouts, you can either use a JSON parser that supports these deviations (for\r
example libyajl), transform the layout file to a JSON-conforming file, or\r
-<a href="http://cr.i3wm.org/">submit a patch</a> to make <tt>i3-save-tree(1)</tt> optionally\r
-output standard-conforming JSON.</p></div>\r
+<a href="https://github.com/i3/i3/blob/next/.github/CONTRIBUTING.md">submit a patch</a>\r
+to make <tt>i3-save-tree(1)</tt> optionally output standard-conforming JSON.</p></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_troubleshooting">4. Troubleshooting</h2>\r
+<div class="sectionbody">\r
+<div class="sect2">\r
+<h3 id="_restoring_a_vertically_split_workspace">4.1. Restoring a vertically split workspace</h3>\r
+<div class="paragraph"><p>When using <tt>i3-save-tree</tt> with the <tt>--workspace</tt> switch, only the <strong>contents</strong> of\r
+the workspace will be dumped. This means that properties of the workspace\r
+itself will be lost.</p></div>\r
+<div class="paragraph"><p>This is relevant for, e.g., a vertically split container as the base container of\r
+a workspace. Since the split mode is a property of the workspace, it will not be\r
+stored. In this case, you will have to manually wrap your layout in such a\r
+container:</p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>// vim:ts=4:sw=4:et\r
+{\r
+ // this is a manually added container to restore the vertical split\r
+ "layout": "splitv",\r
+ "percent": 0.5,\r
+ "type": "con",\r
+ "nodes": [\r
+\r
+ // the dumped workspace layout goes here\r
+\r
+ ]\r
+}</tt></pre>\r
+</div></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_placeholders_using_window_title_matches_don_8217_t_swallow_the_window">4.2. Placeholders using window title matches don’t swallow the window</h3>\r
+<div class="paragraph"><p>If you use the <tt>title</tt> attribute to match a window and find that it doesn’t\r
+work or only works sometimes, the reason might be that the application sets the\r
+title only after making the window visible. This will be especially true for\r
+programs running inside terminal emulators, e.g., <tt>urxvt -e irssi</tt> when\r
+matching on <tt>title: "irssi"</tt>.</p></div>\r
+<div class="paragraph"><p>One way to deal with this is to not rely on the title, but instead use, e.g.,\r
+the <tt>instance</tt> attribute and running the program to set this window instance to\r
+that value:</p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt># Run irssi via\r
+# urxvt -name "irssi-container" -e irssi\r
+\r
+"swallows": [\r
+ {\r
+ "class": "URxvt",\r
+ "instance": "irssi-container"\r
+ }\r
+]</tt></pre>\r
+</div></div>\r
</div>\r
</div>\r
</div>\r
</div>\r
<div id="footnotes"><hr /></div>\r
<div id="footer" lang="de">\r
-© 2009-2011 Michael Stapelberg, <a href="/impress.html">Impressum</a>\r
+ © 2009-present Michael Stapelberg,\r
+ <a href="/impress.html">Impressum</a>,\r
+ <a href="https://github.com/i3/i3.github.io">Source</a>\r
</div>\r
</body>\r
</html>\r