Skip to content

Terminal doesn't respect "start /max" and "/min" parameters when running a console app as default terminal #12154

Closed

Description

@bzzrak

Windows Terminal version

1.11.3471.0

Windows build number

10.0.22000.434

Other Software

Seemingly any console application (cmd, powershell, python, batch file) -- I'm using python as an example here.

Steps to reproduce

  1. set terminal as default terminal
  2. open command prompt in terminal
  3. run for example "start /max python.exe" (or powershell, or cmd, or some batch file)
  4. 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"
image
image

Actual Behavior

New window starts windowed
image

Activity

  1. ghost added
    Needs-Triage
    on Jan 13, 2022
  2. ghost added
    Needs-Tag-Fix
    on Jan 13, 2022
  3. bzzrak commented on Jan 13, 2022

    @bzzrak
    Author

    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.

    image

    image

  4. 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
  5. zadjii-msft commented on Jan 13, 2022

    @zadjii-msft
    Member

    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.

    Lemme add Michael Niksa (@miniksa), see what he thinks

    (fat fingered enter, sorry about that)

  6. added
    Needs-Discussion
    Product-Terminal
    on Jan 13, 2022
  7. eryksun commented on Jan 13, 2022

    @eryksun

    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.

  8. added
    Issue-Feature
    and removed
    Needs-Triage
    Needs-Discussion
    on Jan 31, 2022
  9. ghost removed
    Needs-Tag-Fix
    on Jan 31, 2022
  10. 5 remaining items

  11. added
    Priority-0
    on Jul 14, 2022
  12. zadjii-msft commented on Apr 6, 2023

    @zadjii-msft
    Member

    Note: For discussion:

    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)

  13. added
    Needs-Discussion
    on Apr 6, 2023
  14. removed
    Needs-Discussion
    on Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-DefAppIssue-FeatureNeeds-Tag-FixPriority-0Product-Terminal

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions