Show/Hide Operations on ::GetConsoleWindow() do not work against Terminal through ConPTY #16860

Open
opened 2026-01-31 05:25:19 +00:00 by claunia · 0 comments
Owner

Originally created by @miniksa on GitHub (Feb 24, 2022).

Originally assigned to: @zadjii-msft on GitHub.

In attempting to make the Windows Terminal be the default terminal (#7414), we've discovered in testing that there are a lot of scenarios that were relying on manipulating the window handle from ::GetConsoleWindow() in one way or another to show or hide the window state.

While we strongly discourage this as it isn't guaranteed to work in a universal way across platforms and systems... and is one of the APIs we have listed as "deprecated" on docs.microsoft.com for that exact reason... we're going to make a compromise solution here to try to make it work in enough scenarios that it will maintain compatibility with existing tooling that is relying on it. (One of the primary tenets of moving to Virtual Terminal sequences and the ConPTY is to make everything work in the "universal language" that all platforms support, so we strongly resist doing things "for Windows only".)

It looks like XTWINOPS (see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html) is an existing sequence that will allow us to translate the window operations coming in and send them to the remote Terminal window.

This may also work for some of the z-ordering issues of #2988 going forward.

The test case here specifically is doing:

::ShowWindow(::GetConsoleWindow(), SW_HIDE);

Or one of the other SW_* actions.

Originally created by @miniksa on GitHub (Feb 24, 2022). Originally assigned to: @zadjii-msft on GitHub. In attempting to make the Windows Terminal be the default terminal (#7414), we've discovered in testing that there are a lot of scenarios that were relying on manipulating the window handle from `::GetConsoleWindow()` in one way or another to show or hide the window state. While we strongly discourage this as it isn't guaranteed to work in a universal way across platforms and systems... and is one of the APIs we have listed as "deprecated" on `docs.microsoft.com` for that exact reason... we're going to make a compromise solution here to try to make it work in enough scenarios that it will maintain compatibility with existing tooling that is relying on it. (One of the primary tenets of moving to Virtual Terminal sequences and the ConPTY is to make everything work in the "universal language" that all platforms support, so we strongly resist doing things "for Windows only".) It looks like **XTWINOPS** (see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html) is an existing sequence that will allow us to translate the window operations coming in and send them to the remote Terminal window. This may also work for some of the z-ordering issues of #2988 going forward. The test case here specifically is doing: ``` ::ShowWindow(::GetConsoleWindow(), SW_HIDE); ``` Or one of the other `SW_*` actions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16860