Problem
I'm using Sway window manager, but the same applies to i3 I guess.
On startup I want to start 2 terminal windows on the same workspace. One of them will run Neovim, and the second one will be an empty (not running any app) terminal. 2 terminals should be displayed in tabbed layout, but the empty terminal should have stacking layout set, so that when I open a new terminal from it, it'll display as a new stack entry in the second tab. Visually:
On startup
-------------------------------------------------------------------------------
| Tab: Terminal with Neovim | Tab: Other terminals (active) |
-------------------------------------------------------------------------------
| |
| |
| |
| |
| |
| |
| Terminal 1 |
| |
| |
| |
| |
| |
| |
-------------------------------------------------------------------------------
After opening a new terminal on other terminal tabs
-------------------------------------------------------------------------------
| Tab: Terminal with Neovim | Tab: Other terminals (active) |
-------------------------------------------------------------------------------
| Other terminals tab: Stack entry: Terminal 1 |
-------------------------------------------------------------------------------
| Other terminals tab: Stack entry: Terminal 2 (active) |
-------------------------------------------------------------------------------
| |
| |
| |
| |
| Terminal 2 |
| |
| |
| |
| |
-------------------------------------------------------------------------------
Question
How can I configure such layout on startup in Sway/i3?
I tried adding the following to the config file, but it doesn't work. Both terminal windows are displayed, but their layouts are not set properly. I guess it happens because of exec
executing asynchronously, so that when layout
commands are executed, the containers are still not open.
exec swaymsg "workspace $workspace_programming; exec $term --command nvim; layout tabbed; exec $term; split vertical; layout stacking"