I'd like to create a shell script that resizes the iTerm2 terminal window in which the shell (bash) is running, to a certain fixed width (in columns, though i could put up with pixels if need be).
Although iTerm has a lot of ways for the shell to talk to it, I haven't found a way to do this. Is it possible, and how?
I did find the "Disable session-initiated window resizing" control in iTerm2 (see https://groups.google.com/forum/#!searchin/iterm2-discuss/resize$20window%7Csort:relevance/iterm2-discuss/fSMynSUmat0/6fXo1bZwBwAJ), but unchecking that doesn't help. That thread mentions the 'resize' command, but that works with Apple Terminal and not with iTerm2.
I've searched the doc on the iTerm2 site, and other iTerm2-flagged questions here, both to no avail.
I'd also like to be able to test from a shell script, whether it's running in an iTerm2 terminal or not.
I tried the solution described for Apple Terminal at https://apple.stackexchange.com/questions/33736/can-a-terminal-window-be-resized-with-a-terminal-command, and it appears to work for iTerm2 as well. Wish it were documented somewhere more accessible....
For example:
printf '\e[8;50;80t'
where "50" is the number of lines, and "80" is the number of columns.
Better answers, or pointers to where iTerm or bash or stty or something might document this escape sequence, are still welcome.