-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Terminal doesn't get focus when configured as default terminal and console app launched from Visual Studio #11952
Comments
Huh. Interesting. I bet VS doesn't know what to do when the initial conhost process doesn't create a HWND that it can bring to the top. This might be related to #2988, but hopefully there's a simpler workaround for defterm. |
Confirmed this is an issue on VS2022 on Windows 11. |
Well actually, Visual Studio should get the focus back! Because this is also what happens when I use the default ConHost! This allows for immediately continue to work on your code and repeatedly restarting new debug sessions, which all reuse the same console/terminal again (which is absolutely great because it enables placing your console/terminal window on a fixed position on the screen, really great when using multiple monitors). However somehow focus goes wrong in the case of the Windows Terminal, the focus ends up kind of nowhere, which completely breaks this great working experience. Now we need to use the mouse to focus back to Visual Studio to continue working. While I never want to use the mouse more than strictly necessary. What is so fustrating is that I really like the Terminal and use it a lot, but the Visual Studio focus problem keeps me back from using the Terminal as the default console application. When it happens and I look at the taskbar, I see that it's the Terminal which stays the active window, but somehow the focus is not actually inside it anymore or something, really strange. Thinking further about this... |
I have found a fix for this (works for me anyway). In my Windows Terminal settings if I change "Default terminal application" from "Windows Terminal" to "Let Windows decide", the focus is switched to the terminal when debugging from Visual Studio. I am running Visual Studio Community 2022 on Windows 11. Edit: Sometimes it still doesn't switch focus to the terminal even with this setting... |
toggle the focus mode did it for me. however it will remove the top bar and the console tabs. |
Windows Terminal version
1.11.2921.0
Windows build number
10.0.22000.348
Other Software
Microsoft Visual Studio Community 2019
Version 16.11.5
VisualStudio.16.Release/16.11.5+31729.503
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Community
Visual C++ 2019 00435-60000-00000-AA754
Microsoft Visual C++ 2019
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ASP.NET and Web Tools 2019 16.11.75.64347
ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2019 16.11.75.64347
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.11.75.64347
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 16.11.75.64347
Azure Functions and Web Jobs Tools
C# Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 5.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Razor (ASP.NET Core) 16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 16.0.62107.28140
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Steps to reproduce
Expected Behavior
Windows Terminal to appear with focus
Actual Behavior
Windows Terminal appears with the program output however it doesn't have focus requiring extra Alt+Tab or mouse click before "press any key to close this window" works.
The text was updated successfully, but these errors were encountered: