Skip to content

Instantly share code, notes, and snippets.

@arielshaqed
Last active January 1, 2019 15:23
Show Gist options
  • Save arielshaqed/d45576d4d59616c3f3f591a86b96ce9e to your computer and use it in GitHub Desktop.
Save arielshaqed/d45576d4d59616c3f3f591a86b96ce9e to your computer and use it in GitHub Desktop.
Resize an iTerm* or xterm or ...
#!/usr/bin/env python2
# Generates a control sequence for resizing a window. These are all
# described at https://invisible-island.net/xterm/ctlseqs/ctlseqs.html.
import click
@click.command()
@click.option('--rows', default=60, help='Number of rows.')
@click.option('--cols', default=80, help='Number of columns.')
def resize(rows, cols):
print("\x1b[8;{rows};{cols}t".format(rows=rows, cols=cols))
if __name__ == '__main__':
resize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment