terminal icon indicating copy to clipboard operation
terminal copied to clipboard

How do you create a grid layout of panes equally distributed from a script?

Open brupelo opened this issue 2 years ago • 0 comments

Consider this script foo.cmd

set BD=d:\

wt -w %~n0 ^
nt --title="tab1" --startingDirectory=%BD% ; ^
sp --title="tab2" --startingDirectory=%BD% ; ^
sp --title="tab3" --startingDirectory=%BD% ; ^
sp --title="tab4" --startingDirectory=%BD% ; ^
sp --title="tab5" --startingDirectory=%BD% ; ^
sp --title="tab6" --startingDirectory=%BD% ;

When I run it from the terminal I'll get this:

image

There are few questions here:

  1. You can see how a new tab called "Command Prompt" has been created, is there any way to prevent that?

  2. I'd like to learn how to arrange my 6 panes in something like this:

image

In the above image I did that manually but I'd like to create this sort of arrangement from my script foo.cmd, so how can I modify my script to acomplish that?

Basically my goal is each pane is taking 1/6 of the total client area.

  1. What's the rationale of wt sp --help, wt --help, ... , wt cmd --help creating a window rather than writing to stdout as usual?

  2. Let's say on %BD% there is a virtualenv that i want to activate venv\Scripts\activate so then I can run few scripts python fancy_server, how can I modify my script to do that?

I wasn't sure where to ask these question... although reading the docs I'm still trying to figure out how you could achieve this one.

Maybe having a section

image

would be more convenient?

Thanks in advance!

Ps. Basically the idea here is migrating some old conemu scripts where i'd be able to spin up few microservices like this:

-cur_console:d:d:\microservices\local -cur_console:t:microservice1 cmd /k run_ms1.cmd

-cur_console:ns1T65H -cur_console:d:d:\microservices\local -cur_console:t:microservice2 cmd /k run_ms2.cmd

-cur_console:ns1T50V -cur_console:d:d:\microservices\local -cur_console:t:microservice3 cmd /k run_ms3.cmd

-cur_console:ns2T50V -cur_console:d:d:\microservices\local -cur_console:t:microservice4 cmd /k run_ms4.cmd

-cur_console:ns2T50H -cur_console:d:d:\microservices\local -cur_console:t:microservice5 cmd /k run_ms5.cmd

> -cur_console:ns4T50H -cur_console:d:d:\microservices\local -cur_console:t:microservice6 cmd /k run_ms6.cmd

where each run_ms.cmd would cd/pushd/popd into the microservice directory and call python, docker, whatever... I'd like to learn how to accomplish this (having this in a single standalone script would be great) using windows terminal

brupelo avatar Dec 25 '22 09:12 brupelo