async_send_text ( cmd_bottom_left + ' \n ' ) await bottom_right. async_split_pane ( vertical =True ) # Run commands on each of the panes await bottom_left. async_split_pane ( vertical =True ) bottom_right = await bottom_left. async_split_pane ( vertical =False, before =True ) top_right = await top_left. current_session # Split the tab into multiple panes top_left = await bottom_left. current_terminal_window if window is not None : # Start a new tab tab = await window. ![]() async_get_app ( connection ) window = app. Step 2 - Edit and paste the following script: #!/usr/bin/env python3.7 import iterm2 # The commands to run cmd_top_left = " cd /path/to/script & make runDatastore " cmd_top_right = " cd /path/to/script & make runPubSub " cmd_bottom_right = " cd /path/to/script & npm run dev " cmd_bottom_left = " cd /path/to/project2 & npm run dev " async def main ( connection ): app = await iterm2. Go to Menubar -> Scripts -> Manage -> New Python Script, select “Basic” and then “Simple”. How to start multiple terminal panes with one command ![]() ![]() Turns out it’s quite easy using the iTerm Python API and iTerm panes. That made me wonder, is there a way to automate iTerm2 and start multiple sessions with one command? Ideally, all the necessary app sessions would take up only 1 tab. I’ve recently started working on a project where I have to run multiple terminal based tools/watchers simultaneously, and starting up multiple tabs or panes in multiple directories just for development can get a bit cumbersome.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |