You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Terminal doesn't respect "start /max" and "/min" parameters when running a console app as default terminal #12154
Area-DefAppIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsPriority-0Bugs that we consider release-blocking/recall-class (P0)Product-TerminalThe new Windows Terminal.
Seemingly any console application (cmd, powershell, python, batch file) -- I'm using python as an example here.
Steps to reproduce
set terminal as default terminal
open command prompt in terminal
run for example "start /max python.exe" (or powershell, or cmd, or some batch file)
the window will show windowed, not maximised
Expected Behavior
New window starts maximised, as it does when the default Windows console is set.
The correct behaviour also happens if you run wt.exe itself, i.e. "start /max wt python"
The /min parameter is even worse. "start /min python.exe" starts the classic console, while "start /min wt python.exe" does make a minimised WT window, but you can't switch to it for some reason.
changed the title [-]Terminal doesn't respect "start /max" parameter when running a console app as default terminal[/-][+]Terminal doesn't respect "start /max" and "/min" parameters when running a console app as default terminal[/+]on Jan 13, 2022
Alright, so there are three elements here. From the bottom up:
start /min wt python.exe we're tracking in START /MIN WT? #9053, so feel free to continue that element there.
"start /min python.exe opens conhost" This is kinda by design for now. There are a LOT of apps that run commandline tools in "hidden" console windows, so defterm is pretty aggressive about not attaching to those kinds of launches. We don't necessarily want to pop up a Terminal window when a console window wouldn't have been visible to the user.
"start /max python.exe doesn't open the Terminal maximized" now, that's a real issue. Or at least, it's something we should have an answer for.
We may need to pass some blob of parameters to defterm invocations describing how the terminal application should be launched. That might take care of both /min and /max.
Without knowing the details of what's possible, I'd expect Terminal to honor relevant fields in STARTUPINFO after a handoff from conhost. When a new tab (not a window) is created, I'd expect it to use lpTitle and -- if they're still relevant in any way -- dwXCountChars, dwYCountChars, and dwFillAttribute. When a new window is created, I'd expect it to honor the window's initial show state, position, and size: wShowWindow, dx, dy, dwXSize, and dwYSize. If honoring a setting isn't possible or isn't relevant when using Terminal as the default, please document it for STARTUPINFO, or document it in the console docs.
I understand skipping the handoff to Terminal if wShowWindow is SW_HIDE (0). A hidden Terminal window would be dysfunctional since a console app can't programmatically restore the window, and neither can the user. I don't understand skipping the handoff for SW_SHOWMINIMIZED (2), SW_MINIMIZE (6), SW_SHOWMINNOACTIVE (7), and SW_FORCEMINIMIZE (11). In principle, the user can easily restore a minimized terminal. Maybe this was implemented because Terminal doesn't support wShowWindow properly. For example, as mentioned above, start /min wt is broken. It's better to use the classic console until that gets fixed.
I'm leaning towards closing this out with the combo of #14222 and #13838. We can pass the startup info into the Terminal now, but I'm reluctant to change the behavior where defterm filters out start /min cli-app.exe invocations. start /min wt cli-app.exe will work, and start /max cli-app.exe will both launch into the terminal, and start /min cli-app.exe will open a minimized conhost running cli-app.exe. As further noted in #14222 (comment)
Area-DefAppIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsPriority-0Bugs that we consider release-blocking/recall-class (P0)Product-TerminalThe new Windows Terminal.
Activity
bzzrak commentedon Jan 13, 2022
The /min parameter is even worse. "start /min python.exe" starts the classic console, while "start /min wt python.exe" does make a minimised WT window, but you can't switch to it for some reason.
[-]Terminal doesn't respect "start /max" parameter when running a console app as default terminal[/-][+]Terminal doesn't respect "start /max" and "/min" parameters when running a console app as default terminal[/+]zadjii-msft commentedon Jan 13, 2022
Alright, so there are three elements here. From the bottom up:
start /min wt python.exewe're tracking in START /MIN WT? #9053, so feel free to continue that element there.start /min python.exeopens conhost" This is kinda by design for now. There are a LOT of apps that run commandline tools in "hidden" console windows, so defterm is pretty aggressive about not attaching to those kinds of launches. We don't necessarily want to pop up a Terminal window when a console window wouldn't have been visible to the user.start /max python.exedoesn't open the Terminal maximized" now, that's a real issue. Or at least, it's something we should have an answer for.We may need to pass some blob of parameters to defterm invocations describing how the terminal application should be launched. That might take care of both
/minand/max.Lemme add Michael Niksa (@miniksa), see what he thinks
(fat fingered enter, sorry about that)
eryksun commentedon Jan 13, 2022
Without knowing the details of what's possible, I'd expect Terminal to honor relevant fields in
STARTUPINFOafter a handoff from conhost. When a new tab (not a window) is created, I'd expect it to uselpTitleand -- if they're still relevant in any way --dwXCountChars,dwYCountChars, anddwFillAttribute. When a new window is created, I'd expect it to honor the window's initial show state, position, and size:wShowWindow,dx,dy,dwXSize, anddwYSize. If honoring a setting isn't possible or isn't relevant when using Terminal as the default, please document it forSTARTUPINFO, or document it in the console docs.I understand skipping the handoff to Terminal if
wShowWindowisSW_HIDE(0). A hidden Terminal window would be dysfunctional since a console app can't programmatically restore the window, and neither can the user. I don't understand skipping the handoff forSW_SHOWMINIMIZED(2),SW_MINIMIZE(6),SW_SHOWMINNOACTIVE(7), andSW_FORCEMINIMIZE(11). In principle, the user can easily restore a minimized terminal. Maybe this was implemented because Terminal doesn't supportwShowWindowproperly. For example, as mentioned above,start /min wtis broken. It's better to use the classic console until that gets fixed.5 remaining items
Wire up passing LNK/EXE data from OpenCon to ITerminalHandoff (#13570)
Wire up passing LNK/EXE data from OpenCon to ITerminalHandoff (#13570)
Respect the "/max" parameter when starting console apps with defterm …
Respect the "/max" parameter when starting console apps with defterm …
zadjii-msft commentedon Apr 6, 2023
I'm leaning towards closing this out with the combo of #14222 and #13838. We can pass the startup info into the Terminal now, but I'm reluctant to change the behavior where defterm filters out
start /min cli-app.exeinvocations.start /min wt cli-app.exewill work, andstart /max cli-app.exewill both launch into the terminal, andstart /min cli-app.exewill open a minimized conhost runningcli-app.exe. As further noted in #14222 (comment)