Skip to content

Instantly share code, notes, and snippets.

@andresrinivasan
Created December 28, 2022 06:12
Show Gist options
  • Select an option

  • Save andresrinivasan/db6b6cd09f15ce249305ce5a1fd1b698 to your computer and use it in GitHub Desktop.

Select an option

Save andresrinivasan/db6b6cd09f15ce249305ce5a1fd1b698 to your computer and use it in GitHub Desktop.
Create and raise iTerm window
#!/usr/bin/env python3
import sys
import iterm2
async def main(connection):
w = await iterm2.Window.async_create(connection)
await w.async_activate() # Not sufficient to always raise the window
a = await iterm2.async_get_app(connection)
await a.async_activate(False, True) # Raise only current active window
if __name__ == "__main__":
iterm2.run_until_complete(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment