open Windows Terminal maximized

This commit is contained in:
Lincoln Stein 2023-06-05 00:24:13 -04:00
parent 1a5a2dfda9
commit 603c9a587e

View File

@ -19,6 +19,8 @@ from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
# ------------------------------------- # -------------------------------------
def set_terminal_size(columns: int, lines: int): def set_terminal_size(columns: int, lines: int):
ts = get_terminal_size() ts = get_terminal_size()
if ts.columns >= columns and ts.lines >= lines:
return
width = max(columns,ts.columns) width = max(columns,ts.columns)
height = max(lines,ts.lines) height = max(lines,ts.lines)
@ -27,11 +29,12 @@ def set_terminal_size(columns: int, lines: int):
# The new Windows Terminal doesn't resize, so we relaunch in a CMD window. # The new Windows Terminal doesn't resize, so we relaunch in a CMD window.
# Would prefer to use execvpe() here, but somehow it is not working properly # Would prefer to use execvpe() here, but somehow it is not working properly
# in the Windows 10 environment. # in the Windows 10 environment.
if 'WT_SESSION' in os.environ: if 'WT_SESSION' in os.environ and 'IA_RELAUNCHED' not in os.environ:
args=['conhost'] args=['wt','-M']
args.extend(sys.argv) args.extend(sys.argv)
os.environ.pop('WT_SESSION') os.environ.pop('WT_SESSION')
os.execvp('conhost',args) os.environ['IA_RELAUNCHED'] = 'True'
os.execvp('wt',args)
else: else:
_set_terminal_size_powershell(width,height) _set_terminal_size_powershell(width,height)
elif OS in ["Darwin", "Linux"]: elif OS in ["Darwin", "Linux"]: