Created
May 5, 2020 22:36
-
-
Save mikemurray/20ea196aa6a108a999f03f19b13e88f1 to your computer and use it in GitHub Desktop.
iTerm 2 open all my tabs and panes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import iterm2 | |
# To install, update, or remove packages from PyPI, use Scripts > Manage > Manage Dependencies... | |
async def main(connection): | |
# Your code goes here. Here's a bit of example code that adds a tab to the current window: | |
app = await iterm2.async_get_app(connection) | |
window = app.current_terminal_window | |
window = await window.async_create(connection) | |
if window is not None: | |
### TAB 1 | |
tab1 = window.current_tab | |
# Top Left | |
tab1_session_topLeft = tab1.current_session | |
await tab1_session_topLeft.async_send_text("cd ~/Projects/reaction/reaction-platform/reaction\n") | |
# Top Right | |
tab1_session_topRight = await tab1_session_topLeft.async_split_pane(vertical=True) | |
await tab1_session_topRight.async_send_text("cd ~/Projects/reaction/reaction-platform/reaction-identity\n") | |
# Bottom Left | |
tab1_session_bottomLeft = await tab1_session_topLeft.async_split_pane(vertical=False) | |
await tab1_session_bottomLeft.async_send_text("cd ~/Projects/reaction/reaction-platform/reaction\n") | |
# Bottom Right | |
tab1_session_bottomRight = await tab1_session_topRight.async_split_pane(vertical=False) | |
await tab1_session_bottomRight.async_send_text("cd ~/Projects/reaction/reaction-platform/reaction-hydra\n") | |
### TAB 2 | |
tab2 = await window.async_create_tab() | |
# Top Left | |
tab2_session_topLeft = tab2.current_session | |
await tab2_session_topLeft.async_send_text("cd ~/Projects/reaction/reaction-admin\n") | |
# Top Right | |
tab2_session_topRight = await tab2_session_topLeft.async_split_pane(vertical=True) | |
await tab2_session_topRight.async_send_text("cd ~/Projects/reaction/reaction-platform/example-storefront\n") | |
# Bottom Left | |
tab2_session_bottomLeft = await tab2_session_topLeft.async_split_pane(vertical=False) | |
await tab2_session_bottomLeft.async_send_text("cd ~/Projects/reaction/reaction-admin\n") | |
# Bottom Right | |
tab2_session_bottomRight = await tab2_session_topRight.async_split_pane(vertical=False) | |
await tab2_session_bottomRight.async_send_text("cd ~/Projects/reaction/reaction-platform/example-storefront\n") | |
else: | |
# You can view this message in the script console. | |
print("No current window") | |
iterm2.run_until_complete(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment