Skip to content

Instantly share code, notes, and snippets.

@cshuaimin
Created October 26, 2020 06:23
Show Gist options
  • Save cshuaimin/1eb19d95a0372790983d7e48e03403dd to your computer and use it in GitHub Desktop.
Save cshuaimin/1eb19d95a0372790983d7e48e03403dd to your computer and use it in GitHub Desktop.
iTerm2 autolaunch script for scd
#!/usr/local/bin/python3
import iterm2
# This script was created with the "basic" environment which does not support adding dependencies
# with pip.
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)
tab = app.current_terminal_window.current_tab
left = tab.current_session
right = await left.async_split_pane(vertical=True)
total_width = left.preferred_size.width + right.preferred_size.width
left.preferred_size.width = int(total_width * 0.25)
right.preferred_size.width = total_width - left.preferred_size.width
await tab.async_update_layout()
await left.async_send_text('exec scd\n')
await right.async_send_text('scd fish-init | source\n')
iterm2.run_until_complete(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment