Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back ShowWindow functionality #13248

Closed
Tracked by #13392
FoxtrotSierra6829 opened this issue Jun 8, 2022 · 8 comments · Fixed by #13624
Closed
Tracked by #13392

Bring back ShowWindow functionality #13248

FoxtrotSierra6829 opened this issue Jun 8, 2022 · 8 comments · Fixed by #13624
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Question For questions or discussion Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@FoxtrotSierra6829
Copy link

Description of the new feature/enhancement

Bring back ShowWindow functionality as after #13164 only hiding the window works.

Proposed technical implementation details (optional)

@FoxtrotSierra6829 FoxtrotSierra6829 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jun 8, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 8, 2022
@DHowett
Copy link
Member

DHowett commented Jun 8, 2022

Do you have a specific need for this, and can you explain it? That would help us prioritize it...

@DHowett DHowett added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 8, 2022
@FoxtrotSierra6829
Copy link
Author

Yes, I got a node application using https://github.com/felixhao28/node-systray and https://github.com/hetrodoo/hetrodo-node-hide-console-window-napi which is intended to be hidden to tray by default but which can be un-hidden to allow watching status information. While this works very well with windows console host set as default terminal application, it does not with windows terminal.

https://github.com/flybywiresim/simbridge

Windows Console Host
simbridge.windows.console.host.mp4
Windows Terminal Preview
simbridge.windows.terminal.preview.mp4

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jun 8, 2022
@zadjii-msft
Copy link
Member

Out of curiosity - how do you expect your app to work in a multi-tab, multi-pane scenario? We don't have a lot of folks even attempting this in the wild, so any and all feedback is appreciated ☺️

  • What would you expect if you tried to ShowWindow(GetConsoleWindow(), SW_SHOW) from an inactive tab? (e.g. user starts the script, switches to another tab and starts working there, and eventually the script in the inactive tab calls ShowWindow)
  • Same question, but for an inactive pane
  • Same as the above questions, but now you've minimized the Terminal (e.g. an inactive tab, in a minimized window, calls ShowWindow)
  • Would outputting the XTWINOPS sequences CSI 1 t and CSI 2 t for show/minimize be possible for you rather than calling ShowWindow on GetConsoleWindow? I don't think that works today, but that might be easier to fix.

@DHowett
Copy link
Member

DHowett commented Jun 8, 2022

I've got a couple others:

  • If there are multiple panes currently visible, and the application in one of them decides to hide its "console window", does that pane get sent away?
    • Where to? How can the user discover it if the application doesn't offer a tray icon?
    • What happens if the window that was hosting it, or the tab that was hosting it, is closed in the meanwhile? (The user wouldn't have known the window was harboring an invisible console)
  • How should this work user-driven preferences like "always on top" or the use of the Quake-style window (which is docked at the top of the screen and can be summoned with a hotkey)?

@DHowett
Copy link
Member

DHowett commented Jun 8, 2022

(I'm not asking to discourage you, I'm asking because these are the kinds of things that Terminal forces us to think about. Since it's an upending of the Console infrastructure that has existed on Windows for a few decades, we have to get these things right.)

@FoxtrotSierra6829
Copy link
Author

FoxtrotSierra6829 commented Jun 8, 2022

  • What would you expect if you tried to ShowWindow(GetConsoleWindow(), SW_SHOW) from an inactive tab? (e.g. user starts the script, switches to another tab and starts working there, and eventually the script in the inactive tab calls ShowWindow)

I would expect it to switch the tab to the previously inactive one and focus on it.

  • Same question, but for an inactive pane

I'd expect it to focus on the pane which is tied to the call

  • Same as the above questions, but now you've minimized the Terminal (e.g. an inactive tab, in a minimized window, calls ShowWindow)

It should maximize the Terminal, focus on the tab which is tied to the call and if applicable, focus the specific pane.

  • Would outputting the XTWINOPS sequences CSI 1 t and CSI 2 t for show/minimize be possible for you rather than calling ShowWindow on GetConsoleWindow? I don't think that works today, but that might be easier to fix.

Given my previous answers, this would not behave exactly as described, but at least it would provide some basic functionality. In my case, it might be sufficient as an itermediate solution, tho it would probably not work with hiding it to tray in future either.

  • If there are multiple panes currently visible, and the application in one of them decides to hide its "console window", does that pane get sent away?

I'd expect it to ask for confirmation to hide the entire window, same for tabs. I can't really think of a scenario where one would want to temporarily hide one pane as in that case tabs or multiple windows would be more suitable.

  • How should this work user-driven preferences like "always on top" or the use of the Quake-style window (which is docked at the top of the screen and can be summoned with a hotkey)?

Always on top should be affected in the same way as a minimize call does now, as I expect show and hide calls to be user-desired. Else an option to disable this functionality entirely could be considered. The Quake-style window should be hidden when ShowWindow is being set to false, and restored when ShowWindow is being set to true.

zadjii-msft added a commit that referenced this issue Jul 28, 2022
…ing with taskbar

Curiously, at least on Windows 10 (and rarely on Windows 11), if you minimize the Terminal by clicking on the taskbar, then alt-tab to try and restore the window, the Taskbar will decide to call `SwitchToWindow` on the invisible, owned ConPTY window instead of the main window. When that happens, ConPTY'll get a `WM_SIZE(SIZE_RESTORED, lParam=0)`. The main window will NOT get a `SwitchToWindow` called. If ConPTY doesn't actually inform the hosting process about this, then the main HWND might stay hidden.

* Refer to #13158 where we disabled this.
* Closes #13589
* **TODO** Does this also address #13248
* Tested manually on a Windows 10 VM.
* Confirmed that opening tabs while maximized/snapped doesn't restore down.
* `[Native]::ShowWindow([Native]::GetConsoleWindow(), 6)` still works
@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. Area-Windowing Window frame, quake mode, tearout and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 1, 2022
@ghost ghost added In-PR This issue has a related PR and removed Needs-Tag-Fix Doesn't match tag requirements labels Aug 1, 2022
@ghost ghost closed this as completed in #13624 Aug 1, 2022
ghost pushed a commit that referenced this issue Aug 1, 2022
…ing with taskbar (#13624)

Curiously, at least on Windows 10 (and rarely on Windows 11), if you minimize the Terminal by clicking on the taskbar, then alt-tab to try and restore the window, the Taskbar will decide to call `SwitchToWindow` on the invisible, owned ConPTY window instead of the main window. When that happens, ConPTY'll get a `WM_SIZE(SIZE_RESTORED, lParam=0)`. The main window will NOT get a `SwitchToWindow` called. If ConPTY doesn't actually inform the hosting process about this, then the main HWND might stay hidden.

* Refer to #13158 where we disabled this.
* Closes #13589
* Closes #13248
* Tested manually on a Windows 10 VM.
* Confirmed that opening tabs while maximized/snapped doesn't restore down.
* `[Native]::ShowWindow([Native]::GetConsoleWindow(), 6)` still works
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Aug 1, 2022
DHowett pushed a commit that referenced this issue Aug 8, 2022
…ing with taskbar (#13624)

Curiously, at least on Windows 10 (and rarely on Windows 11), if you minimize the Terminal by clicking on the taskbar, then alt-tab to try and restore the window, the Taskbar will decide to call `SwitchToWindow` on the invisible, owned ConPTY window instead of the main window. When that happens, ConPTY'll get a `WM_SIZE(SIZE_RESTORED, lParam=0)`. The main window will NOT get a `SwitchToWindow` called. If ConPTY doesn't actually inform the hosting process about this, then the main HWND might stay hidden.

* Refer to #13158 where we disabled this.
* Closes #13589
* Closes #13248
* Tested manually on a Windows 10 VM.
* Confirmed that opening tabs while maximized/snapped doesn't restore down.
* `[Native]::ShowWindow([Native]::GetConsoleWindow(), 6)` still works

(cherry picked from commit d1fc112)
Service-Card-Id: 84673887
Service-Version: 1.15
@ghost
Copy link

ghost commented Aug 17, 2022

🎉This issue was addressed in #13624, which has now been successfully released as Windows Terminal v1.14.228.:tada:

Handy links:

@ghost
Copy link

ghost commented Aug 17, 2022

🎉This issue was addressed in #13624, which has now been successfully released as Windows Terminal Preview v1.15.228.:tada:

Handy links:

PKRoma pushed a commit to PKRoma/Terminal that referenced this issue Oct 15, 2022
…ing with taskbar (microsoft#13624)

Curiously, at least on Windows 10 (and rarely on Windows 11), if you minimize the Terminal by clicking on the taskbar, then alt-tab to try and restore the window, the Taskbar will decide to call `SwitchToWindow` on the invisible, owned ConPTY window instead of the main window. When that happens, ConPTY'll get a `WM_SIZE(SIZE_RESTORED, lParam=0)`. The main window will NOT get a `SwitchToWindow` called. If ConPTY doesn't actually inform the hosting process about this, then the main HWND might stay hidden.

* Refer to microsoft#13158 where we disabled this.
* Closes microsoft#13589
* Closes microsoft#13248
* Tested manually on a Windows 10 VM.
* Confirmed that opening tabs while maximized/snapped doesn't restore down.
* `[Native]::ShowWindow([Native]::GetConsoleWindow(), 6)` still works

(cherry picked from commit d1fc112)
Service-Card-Id: 84673887
Service-Version: 1.15
(cherry picked from commit b670800)
Service-Card-Id: 84673886
Service-Version: 1.14
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Question For questions or discussion Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
3 participants