How to split Windows Terminal into 8 equal panes "programmatically"?

Viewed 913

I am trying to split the new Windows Terminal into 8 equal panes by running one or more commands.

Recently Microsoft added support for splitting the new Windows Terminal into panes "programmatically" by using the parameters:

split-pane -H or -V (Horizontal or Vertical pane)

I have tried a dozen combinations of the parameters, but it splits the terminal windows "wrong".

Here is an example:

wt `; split-pane -V -p "pwsh" `; split-pane -H -p "pwsh" `; split-pane -V -p "pwsh"

Here is the desired result: Screenshot of 8 equally split panes in Windows Terminal How would I achieve this programmatically? It's possible to do in the Windows Terminal by using hotkeys ALT+SHIFT+MINUS and ALT+SHIFT+PLUS (see screenshot).

2 Answers

Currenty this is simply not possible using wt.exe on its own however if you are using WSL you could do it with tmux.

In order to get equal spacing of the panes with wt.exe on its own, split-pane size control would need to be supported and that feature is currently in the backlog. Also I think you would probably need to 'nest' the split-pane commands and that is not yet possible in Window Terminal either.

A little late but here is a solution

"startupActions": "-p \"Bash\" ; split-pane -p \"Bash\" -V ; move-focus left ;  split-pane -p \"Bash\" -H ; move-focus right;split-pane -p \"Bash\" -H ; move-focus up ; move-focus left ; split-pane -p \"Bash\" -V ; move-focus down ; split-pane -p \"Bash\" -V ; move-focus right ; move-focus up ; split-pane -p \"Bash\" -V move-focus down ; split-pane -p \"Bash\" -V"

It is not the prettiest but it is working.

Related