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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13838
Author: @zadjii-msft
Created: 8/24/2022
Status: Merged
Merged: 4/18/2023
Merged by: @microsoft-github-policy-service[bot]

Base: mainHead: dev/migrie/b/9053-part-3-the-actual-doing-of-the-thing


📝 Commits (10+)

  • 103beb4 I just want to run the scratch project, I have no idea how this got so brboken
  • c795793 Revert "I just want to run the scratch project, I have no idea how this got so brboken"
  • 11bfc73 A BLANK SCRATCH COMMIT
  • 1dd6e99 prototype
  • 874a15b Good-news-everyone.gif
  • dc78b32 this does temporarily get the title out of the link, but then it's lose
  • 9a2ee6a Cleanup, comments, etc.
  • fd75c5e I think this is all the prototyping I need
  • 4b717db Merge remote-tracking branch 'origin/main' into dev/migrie/f/9458-startupInfoToTerminal
  • c0b4840 Merge remote-tracking branch 'origin/main' into dev/migrie/f/9458-startupInfoToTerminal

📊 Changes

11 files changed (+54 additions, -24 deletions)

View changed files

📝 .github/actions/spelling/expect/expect.txt (+1 -0)
📝 src/cascadia/Remoting/CommandlineArgs.h (+6 -2)
📝 src/cascadia/Remoting/Monarch.h (+3 -1)
📝 src/cascadia/Remoting/Monarch.idl (+1 -0)
📝 src/cascadia/Remoting/Peasant.idl (+2 -1)
📝 src/cascadia/Remoting/WindowManager.cpp (+1 -1)
📝 src/cascadia/ShellExtension/OpenTerminalHere.cpp (+4 -0)
📝 src/cascadia/UnitTests_Remoting/RemotingTests.cpp (+17 -17)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+8 -1)
📝 src/cascadia/WindowsTerminal/AppHost.h (+2 -0)
📝 src/cascadia/WindowsTerminal/WindowEmperor.cpp (+9 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13838 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 8/24/2022 **Status:** ✅ Merged **Merged:** 4/18/2023 **Merged by:** [@microsoft-github-policy-service[bot]](https://github.com/apps/microsoft-github-policy-service) **Base:** `main` ← **Head:** `dev/migrie/b/9053-part-3-the-actual-doing-of-the-thing` --- ### 📝 Commits (10+) - [`103beb4`](https://github.com/microsoft/terminal/commit/103beb4be156d138cce09df2f355304cae526641) I just want to run the scratch project, I have no idea how this got so brboken - [`c795793`](https://github.com/microsoft/terminal/commit/c795793f4c966142a40b1bff47ec5ae4f831fb5f) Revert "I just want to run the scratch project, I have no idea how this got so brboken" - [`11bfc73`](https://github.com/microsoft/terminal/commit/11bfc7340058dd2665415d7e500e9803cb1fda2f) A BLANK SCRATCH COMMIT - [`1dd6e99`](https://github.com/microsoft/terminal/commit/1dd6e993401042e318f43a4240804e731cde520e) prototype - [`874a15b`](https://github.com/microsoft/terminal/commit/874a15b89bf88ac071531bf41b4e6c94a09f80d2) Good-news-everyone.gif - [`dc78b32`](https://github.com/microsoft/terminal/commit/dc78b3267aa56bc77ff0db632579f3f7ba68a9f4) this does temporarily get the title out of the link, but then it's lose - [`9a2ee6a`](https://github.com/microsoft/terminal/commit/9a2ee6a7c29c6bb4c25314acf0e8993594cfbca9) Cleanup, comments, etc. - [`fd75c5e`](https://github.com/microsoft/terminal/commit/fd75c5e1ea6545682f4d10f3c56e5912a51cb7f9) I think this is all the prototyping I need - [`4b717db`](https://github.com/microsoft/terminal/commit/4b717db6f0d3685bcd9ee0dab84189553af3757f) Merge remote-tracking branch 'origin/main' into dev/migrie/f/9458-startupInfoToTerminal - [`c0b4840`](https://github.com/microsoft/terminal/commit/c0b4840dcd204c94896960e5e3f7b97210ee9d49) Merge remote-tracking branch 'origin/main' into dev/migrie/f/9458-startupInfoToTerminal ### 📊 Changes **11 files changed** (+54 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/expect/expect.txt` (+1 -0) 📝 `src/cascadia/Remoting/CommandlineArgs.h` (+6 -2) 📝 `src/cascadia/Remoting/Monarch.h` (+3 -1) 📝 `src/cascadia/Remoting/Monarch.idl` (+1 -0) 📝 `src/cascadia/Remoting/Peasant.idl` (+2 -1) 📝 `src/cascadia/Remoting/WindowManager.cpp` (+1 -1) 📝 `src/cascadia/ShellExtension/OpenTerminalHere.cpp` (+4 -0) 📝 `src/cascadia/UnitTests_Remoting/RemotingTests.cpp` (+17 -17) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+8 -1) 📝 `src/cascadia/WindowsTerminal/AppHost.h` (+2 -0) 📝 `src/cascadia/WindowsTerminal/WindowEmperor.cpp` (+9 -1) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:36:50 +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#29778