the i3 window manager comes pre-packaged with a tool called i3-msg, which can be used to send instructions to i3.
For example, if you want to set a vertical tiling of windows, normally you would press “mod + V”. This can be done programmatically like so:
i3-msg split v
Note that the i3-msg is maintains the state that you set. For example, if you want to spawn three windows after setting i3 to vertical splits:
i3-msg split v xterm -e <my-command> xterm -e <my-command2> xterm -e <my-command3>
i3-msg split v // split vertical i3-msg split h // split horisontal i3-msg workspace 5 // spawn windows at specific workspace i3-msg kill // kill current focused window i3-msg focus parent // switch to containing window