The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

How do I stack two selected window out of 4 windows?

asked 2014-12-01 06:20:51 +0000

Let's say I have 4 windows side by side. How do I group them into 2 groups and stack each of them?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-12-01 08:50:37 +0000

Adaephon gravatar image

updated 2014-12-01 12:40:35 +0000

Let say, you have 4 windows in a horizontally split container, looking like this:

|    |    |    |    |
|    |    |    |    |

And you want to order them into two tabbed containers inside a horizontally split container, looking like this:

|         |         |

One way to do this is:

Focus window "1" and run the following i3 command (here with i3-msg, but it could be bound to a key):

i3-msg 'split vertical, focus right, move left, layout stacking, focus right, split vertical, focus right, move left, layout stacking'


  1. split vertical or split horizontal: creates a split container in place of window "1" with window "1" in it. (Which split does not matter as the layout will be changed in the next step)
  2. layout stacking: switch layout of the new container to stacking
  3. focus right: focuses window "2"
  4. move left: moves window "2" into the stacking container
  5. focus right: focuses window "3"
  6. split vertical or split horizontal: same as step 2.
  7. layout stacking: same as step 3.
  8. focus right: focuses window "4"
  9. move left: moves window "4" into the same stacked container as window "3"

As no window is moved outside of the original split container, this should work reliably even if this container is surrounded by other containers.

If these are the only four windows on a workspace, this would be shorter:

  1. layout stacking
  2. focus window "1"
  3. move left
  4. layout stacking
  5. focus right:should focus window "2"
  6. move left

Generally speaking, to get a certain layout do the following:

  1. Move all needed windows into the same container
  2. Change layout of this container to the desired type. (layout <splith|splitv|tabbed|stacking>)
  3. If a sub-container is needed, use split vertical or split horizontal on one window you want to have in this sub-container. This creates a container with the window in it.
  4. do steps 1. - 3. for the sub-container
  5. If more sub-containers are needed go to step 3.

(Step 1. and 2. are interchangeable)

In some cases there may be shorter ways, but the above should work everytime.

edit flag offensive delete link more


Very clear, and the conclusion to get any certain layout is great!

xuhdev gravatar imagexuhdev ( 2014-12-02 00:24:19 +0000 )edit

Question Tools


Asked: 2014-12-01 06:20:51 +0000

Seen: 526 times

Last updated: Dec 01 '14