[PR #13838] Respect the startup info state initially passed to wt via ShellExecute #29783

Open
opened 2026-01-31 09:36:51 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13838

State: closed
Merged: Yes


Original description, pre-process model v3:

This is just the SHOWDEFAULT bit from #12979. This seems to also work now, but I'm PR'ing it separately so it can be a separate revert from #13811, if it is problematic.

More accurately:
This PR enables terminal windows to use the wShowCmd from the STARTUPINFO passed to windowsterminal.exe to set the initial visibility of the window. We can't just use SW_SHOWDEFAULT, because all the windows are running in the initial process! After the first window, the subsequent ones would ignore any params passed to their originating windowsterminal.exe processes. To mitigate, we pass that wShowCmd info from the source process, to the actual running terminal process. That accounts for most of the delta here.

Closes #9053

This doesn't do the same for defterm-initiated connections. This is because we don't need to! Defterm very explicitly rejects handoff for minimized console apps. This is probably for the best! I put an attempt in 66f8b25ec before I forgot that it was filtered long before the Terminal. NOT doing this for /min saves us all sorts of "what happens if start /min cmd tries to glom?" or "what if someone does start /min cmd && start /max cmd and they glom together?".


Also closes #15193, which was introduced as a part of this.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/13838 **State:** closed **Merged:** Yes --- Original description, pre-process model v3: > This is just the `SHOWDEFAULT` bit from #12979. This seems to also work now, but I'm PR'ing it separately so it can be a separate revert from #13811, if it is problematic. More accurately: This PR enables terminal windows to use the `wShowCmd` from the STARTUPINFO passed to `windowsterminal.exe` to set the initial visibility of the window. We can't just use `SW_SHOWDEFAULT`, because all the windows are running in the initial process! After the first window, the subsequent ones would ignore any params passed to their originating `windowsterminal.exe` processes. To mitigate, we pass that `wShowCmd` info from the source process, to the actual running terminal process. That accounts for most of the delta here. Closes #9053 This doesn't do the same for defterm-initiated connections. This is because we don't need to! Defterm very explicitly rejects handoff for minimized console apps. This is probably for the best! I put an attempt in 66f8b25ec before I forgot that it was filtered long before the Terminal. NOT doing this for /min saves us all sorts of "what happens if `start /min cmd` tries to glom?" or "what if someone does `start /min cmd && start /max cmd` and they glom together?". <hr> Also closes #15193, which was introduced as a part of this.
claunia added the pull-request label 2026-01-31 09:36:51 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29783