Created
August 19, 2020 06:40
-
-
Save gnachman/7785295d72b29472e5b59ccc0f3b2b27 to your computer and use it in GitHub Desktop.
This file contains 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.7 | |
import iterm2 | |
async def main(connection): | |
app = await iterm2.async_get_app(connection) | |
session = app.current_terminal_window.current_tab.current_session | |
async with session.get_screen_streamer(want_contents=True) as streamer: | |
while True: | |
content = await streamer.async_get() | |
for i in range(content.number_of_lines): | |
line = content.line(i) | |
print(line.string) | |
iterm2.run_until_complete(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment