This is a follow-up on a prior question on how to autostart applications on individual workspaces with the i3 window manager and what can and can't be done inside the ~/.i3/config configuration file.

First, the provided solution based on Arch Linux documentation and an update provided by op where he pushes the logic further:

exec --no-startup-id i3-msg 'workspace 1:Web; exec /usr/bin/firefox'
exec --no-startup-id i3-msg 'workspace 1; exec firefox; workspace 2; exec urxvt; workspace 1'

Also of interest is this exchange about leveraging some of that directly on the command line without duplicating:

i3-msg workspace 3; i3-msg exec firefox
i3-msg workspace 9; i3-msg exec chromium

But I have never seen a configuration which autostarts many windows/apps in each workspace according to a desired vertical or horizontal layout. My goal is to autostart this simple configuration I use:

 _____ _____     ___________     ___________
| lx  | lx  |   |        |u_|   |     |     |   proportions:
|_____|_____|   |  FF    |lx|   |spacefm    |   1- 25% each
|medit| lx  |   |        |__|   |     | vlc |   2- 75/25 x 25/50/25
|_____|_____|   |________|u_|   |_____|_____|   3- 50/50
      1               2               3

So it starts with something like this in the config file:

exec --no-startup-id i3-msg 'workspace 1; exec i3-sensible-terminal; layout toggle split; layout splitv; split vertical; exec i3-sensible-terminal; exec i3-sensible-terminal; exec i3-sensible-terminal; workspace 2; exec firefox; exec urxvt; exec i3-sensible-terminal; exec urxvt; workspace 3; exec spacefm; exec vlc'

But how in the world do you achieve the type of layout and vert/horizontal splitting you want? I'm trying, but it's not clear how you "mix" execution and layout. The syntax feels idiosyncratic to start because you're executing i3-img within i3's configuration. Do you use split h (or v) - layout split v - exec layout split v - focus down(or right) in between each exec call??

For a single workspace, the configuration starts all applications either vertically or horizontally and I can't seem to influence layout - or the last split command in the chain decides whether the windows are added vertically or horizontally. i3-msg seemingly ignores parts of the command that aren't properly formatted in some cases so it's hard to debug. This is further compounded by the fact that you really need to quit X and startx again every time to verify the results as just refreshing the configuration with mod+shift+R won't cut it even if you close everything on each of the workspaces.

What is the proper way of configuring this? Does anyone have a solution which implements something like that? The documentation is pretty good but it doesn't provide that I can see a detailed example which mixes execution and layout on multiple workspaces.

  • Also expands on this.
    – user44370
    Commented Jun 9, 2014 at 2:46
  • One doesn't need to be using FF or urxvt to provide a solution. There is nothing special about those programs as far as I know so someone could reproduce layout #2 with whatever programs, save a json file, strip it, see if it can be launched from the config file at login, then simply change the program names before submitting an answer...
    – user44370
    Commented Aug 30, 2014 at 1:10
  • can you upload the part in your i3-file in combination with the saved/restored json-layout please? I have the same problem.. but dont get it to work. Do you use multi displays in your config/json file?
    – user134058
    Commented Sep 14, 2015 at 7:45

1 Answer 1


I believe that you are looking for the new layout-saving feature that was introduced in i3 v4.8 (2014-06-15). The linked documentation seems pretty thorough.

Quoting from the documentation:

Layout saving/restoring allows you to load a JSON layout file so that you can have a base layout to start working with after powering on your computer. Dynamic use-cases also come to mind: if you frequently (but not always!) need a grid layout of terminals with ping/traceroute commands to diagnose network issues, you can easily automate opening these windows in just the right layout.

... and the release notes:

tl;dr: export1 your current layout as JSON file, load it into new i3 sessions, get placeholder windows that will be replaced by the actual apps once you start them.

1. You may require the perl-anyevent-i3 and perl-json-xs packages to use the i3-save-tree utility.

  • 4
    The layout feature is surprisingly challenging to use. Their concept of placeholder window which "swallows" apps means that if you want many times the same app like lxterminal or urxvt for a single workspace, then you have to differentiate them using --name something when you exec them in .i3/config. The example in the doc works but when I use an export from one of my workspace I can't seem to make it work. You use class for the name and instance for what you used with --name. In this case I can only hope for a gui tool seriously, as the json format has so many brackets in it!!
    – user44370
    Commented Jul 4, 2014 at 8:39
  • 2
    I now updated to 4.8 and I'm pretty happy with this new feature. I always had some trouble with starting things up reliably at login from .i3/config also with earlier versions, but once I'm properly logged in, everything works fine. What I did is to arrange a few layouts and save them, then only edit the class variables of the json files. Then something like i3-msg workspace 2\; append_layout mylayout.json\; and then i3-msg exec lxterminal\; exec lxterminal\; exec lxterminal\; exec medit should restore your first desired layout. // Thanks for improving my answer, btw.
    – damien
    Commented Jul 6, 2014 at 14:03
  • In case anyone is coming here after failing to start multiple programs in multiple terminals (all the same type) on startup, the layout will not swallow the terminals unless each terminal is launched with its own title (e.g. xfce4-terminal -T program1 -e program1) and that title matches the title given in the layout's JSON file.
    – 5am
    Commented Jan 7, 2021 at 19:15

You must log in to answer this question.