If you generally prefer stacked containers, I would suggest setting
workspace_layout stacking
in your i3 configuration. That way you start out with a stacked container and when you move a window out of it is again put into a new stacked container.
So, if you just open four windows, you will get
+-Win 1-------------------+
+-Win 2-------------------+
+-Win 3-------------------+
+-Win 4-------------------+
| |
| |
+-------------------------+
If you then move "Win 3" to the right, you get
+-Win 1------+-Win 3------+
+-Win 2------+ |
+-Win 4------+ |
| | |
| | |
| | |
+------------+------------+
And moving "Win 1" to the right after that will have the desired stacked containers side by side:
+-Win 2------+-Win 3------+
+-Win 4------+-Win 1------+
| | |
| | |
| | |
| | |
+------------+------------+
If you want to stay with some other default_orientation
, you still can create a side-by-side layout of stacked containers by manually creating containers and switching them to stacked layout.
Lets say, you again start out with the following layout:
+-Win 1-------------------+
+-Win 2-------------------+
+-Win 3-------------------+
+-Win 4-------------------+
| |
| |
+-------------------------+
If you did not set workspace_layout
or set it explicitly to default
, moving "Win 3" and than "Win 1" to the right will probably get you the following layout (depending on screen orientation and setting of default_orientation
):
+-Win 2--+-Win 1--+-Win 3-+
+-Win 4--+ | |
| | | |
| | | |
| | | |
| | | |
+--------+--------+-------+
That is because moving out "Win 3" did not create a new container, it instead moved "Win 3", and than "Win 1" into the same horizontal split container the initial stacked container resides in.
To avoid this, you need to explicitly create a stacked container around "Win 3" after moving it out. There is no command to do that directly, but it takes only two steps:
- Create a container around the current window with either of the commands
split horizontal
or split vertical
. This will put the current window into a new split container with the window as its only member. (Any new window or window moved into that container would then be sorted next to the initial window inside this container) - Switch the layout of this container to stacking with the command
layout stacking
.
Making use of i3's ability to chain commands, you can just bind split vertical, layout stacking
to a key in order to run both commands with one keypress.
So, after moving "Win 3" out:
+-Win 1------+-Win 3------+
+-Win 2------+ |
+-Win 4------+ |
| | |
| | |
| | |
+------------+------------+
run split horizontal, layout stacking
, than move "Win 1" to the right and you will get the desired result:
+-Win 2------+-Win 3------+
+-Win 4------+-Win 1------+
| | |
| | |
| | |
| | |
+------------+------------+