Terminal loses focus on launch #16370

Closed
opened 2026-01-31 05:05:31 +00:00 by claunia · 6 comments
Owner

Originally created by @amzon-ex on GitHub (Jan 11, 2022).

Windows Terminal version

1.11.3471.0

Windows build number

10.0.22000.376

Other Software

WSL (Ubuntu-21.10)
oh-my-posh 6.42.4 (just listing - don't know if relevant)

Steps to reproduce

When I start Terminal (my default is set to an Ubuntu 21.10 WSL distro) and WSL is not running (on Win startup or shut down forcibly by wsl --shutdown), after WSL starts and the prompt appears, Terminal loses focus and requires clicking on the window (or Alt-Tabbing) to shift focus again. This problem seems remotely related to #11952 but has nothing to do with Visual Studio.
This problem does not happen when WSL is already running.

It happens irrespective of the method I use to start Terminal, primarily 3:

  • Right-click context menu (example video below)
  • Win+X → I method
  • Using Microsoft Powertoys

https://user-images.githubusercontent.com/45428344/148919242-64b1f67d-94e9-46dc-9de4-74189e45d0bd.mp4

Expected Behavior

Terminal launches, acquires focus and stays that way until intended to by the user (or some other relevant process).

Actual Behavior

Terminal launches, acquires focus, but loses it on appearance of the prompt when WSL starts from a shutdown state.

Originally created by @amzon-ex on GitHub (Jan 11, 2022). ### Windows Terminal version 1.11.3471.0 ### Windows build number 10.0.22000.376 ### Other Software WSL (Ubuntu-21.10) oh-my-posh 6.42.4 (just listing - don't know if relevant) ### Steps to reproduce When I start Terminal (my default is set to an Ubuntu 21.10 WSL distro) and WSL is not running (on Win startup or shut down forcibly by `wsl --shutdown`), after WSL starts and the prompt appears, Terminal loses focus and requires clicking on the window (or Alt-Tabbing) to shift focus again. This problem seems remotely related to #11952 but has nothing to do with Visual Studio. This problem does not happen when WSL is already running. It happens irrespective of the method I use to start Terminal, primarily 3: - Right-click context menu (example video below) - `Win+X → I` method - Using Microsoft Powertoys https://user-images.githubusercontent.com/45428344/148919242-64b1f67d-94e9-46dc-9de4-74189e45d0bd.mp4 ### Expected Behavior Terminal launches, acquires focus and stays that way until intended to by the user (or some other relevant process). ### Actual Behavior Terminal launches, acquires focus, but loses it on appearance of the prompt when WSL starts from a shutdown state.
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 05:05:31 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jan 11, 2022):

This sounds like #10050 to me. I bet there's an issue on the WSL issue tracker for this...

@zadjii-msft commented on GitHub (Jan 11, 2022): This sounds like #10050 to me. I bet there's an issue on the WSL issue tracker for this...
Author
Owner

@amzon-ex commented on GitHub (Jan 11, 2022):

I see https://github.com/microsoft/WSL/issues/2597 and https://github.com/microsoft/WSL/issues/3123 both of which are closed and point to https://github.com/microsoft/terminal/issues/179 which has been marked as solved, but the issue apparently persists. Is there any other active thread pertaining to this? I see https://github.com/microsoft/terminal/issues/8720 but it seems a little different, like with all apps. WSL issue tracker seems to redirect back to this repo in many cases.

@amzon-ex commented on GitHub (Jan 11, 2022): I see https://github.com/microsoft/WSL/issues/2597 and https://github.com/microsoft/WSL/issues/3123 both of which are closed and point to https://github.com/microsoft/terminal/issues/179 which has been marked as solved, but the issue apparently persists. Is there any other active thread pertaining to this? I see https://github.com/microsoft/terminal/issues/8720 but it seems a little different, like with all apps. WSL issue tracker seems to redirect back to this repo in many cases.
Author
Owner

@zadjii-msft commented on GitHub (Jan 11, 2022):

@amzon-ex can you check if disabling Linux GUI support by adding the below to .wslconfig (refer docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig)

[wsl2]
guiapplications=false

For linking:

@zadjii-msft commented on GitHub (Jan 11, 2022): @amzon-ex can you check if disabling Linux GUI support by adding the below to `.wslconfig` (refer docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig) ```ini [wsl2] guiapplications=false ``` For linking: * https://github.com/microsoft/WSLg/issues/443 * https://github.com/microsoft/WSL/issues/7511
Author
Owner

@amzon-ex commented on GitHub (Jan 12, 2022):

Whoa, that fixes it! (albeit at the sacrifice of GUI app support...)
I'm on WSLg version 1.0.28, which https://github.com/microsoft/wslg/issues/443 seems to refer to as the patch in which the issue there is not reproducible.

@amzon-ex commented on GitHub (Jan 12, 2022): Whoa, that fixes it! (albeit at the sacrifice of GUI app support...) I'm on WSLg version 1.0.28, which https://github.com/microsoft/wslg/issues/443 seems to refer to as the patch in which the issue there is not reproducible.
Author
Owner

@zadjii-msft commented on GitHub (Jan 12, 2022):

Well, I'm glad we've got a beat on the root cause at least. I'd follow up on their repo with that, so they can fix this. Thanks for the confirmation!

/dup https://github.com/microsoft/WSLg/issues/443

@zadjii-msft commented on GitHub (Jan 12, 2022): Well, I'm glad we've got a beat on the root cause at least. I'd follow up on their repo with that, so they can fix this. Thanks for the confirmation! /dup https://github.com/microsoft/WSLg/issues/443
Author
Owner

@ghost commented on GitHub (Jan 12, 2022):

Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!

@ghost commented on GitHub (Jan 12, 2022): Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16370