Terminal window not receiving focus if started via right mouse button menu in taskbar #11985

Closed
opened 2026-01-31 03:03:09 +00:00 by claunia · 15 comments
Owner

Originally created by @mavnorthwind on GitHub (Jan 7, 2021).

Environment

Microsoft Windows [Version 10.0.19041.685]
Windows Terminal Version1.4.3243.0

Steps to reproduce

Select a different type of shell from the taskbar icon's context menu (probably named Tasks in English):
image

Expected behavior

Windows Terminal window appears with the desired type of shell and immediately receives focus, just like when you simply left-click on the taskbar icon.

Actual behavior

The main window appears, but doesn't receive focus.

Thus, everything you type is lost unless you explicitely click into the window once more before starting to type, which is very inconvenient and annoying.

Originally created by @mavnorthwind on GitHub (Jan 7, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Microsoft Windows [Version 10.0.19041.685] Windows Terminal Version1.4.3243.0 # Steps to reproduce <!-- A description of how to trigger this bug. --> Select a different type of shell from the taskbar icon's context menu (probably named Tasks in English): ![image](https://user-images.githubusercontent.com/15796035/103921951-65423b80-5113-11eb-80d1-37aa2e102bb9.png) # Expected behavior Windows Terminal window appears with the desired type of shell and immediately receives focus, just like when you simply left-click on the taskbar icon. <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior The main window appears, but doesn't receive focus. Thus, everything you type is lost unless you explicitely click into the window once more before starting to type, which is very inconvenient and annoying. <!-- What's actually happening? -->
Author
Owner

@zadjii-msft commented on GitHub (Jan 7, 2021):

Well that's weird. This was originally #179, which was tracked internally by MSFT:18715554. That bug (internally) is marked fixed, and that it should have shipped in 18934.1000.rs_prerelease.190702-1428. It also looks like this was cherry-picked back to 19H1.

Hmmm.

@zadjii-msft commented on GitHub (Jan 7, 2021): Well that's weird. This was originally #179, which was tracked internally by MSFT:18715554. That bug (internally) is marked fixed, and that it should have shipped in 18934.1000.rs_prerelease.190702-1428. It also looks like this was cherry-picked back to 19H1. Hmmm.
Author
Owner

@zadjii-msft commented on GitHub (Jan 8, 2021):

For the record, I also can't repro this locally, on 10.0.20279.1003. It's entirely possible that code is being actively worked on so it may have regressed in 19041, and then been fixed again by 20279. I've reached out to the dev who fixed the original bug, maybe he's got more insight.

@zadjii-msft commented on GitHub (Jan 8, 2021): For the record, I also can't repro this locally, on 10.0.20279.1003. It's entirely possible that code is being actively worked on so it may have regressed in 19041, and then been fixed again by 20279. I've reached out to the dev who fixed the original bug, maybe he's got more insight.
Author
Owner

@DHowett commented on GitHub (Jan 28, 2021):

-Triage on Tracking-External bugs.

@DHowett commented on GitHub (Jan 28, 2021): -Triage on Tracking-External bugs.
Author
Owner

@transentia commented on GitHub (May 21, 2021):

I believe that I am seeing this on:

Windows Terminal Preview
Version: 1.8.1032.0

Windows: 19042.985

The terminal opens, the cursor blinks but nothing is actually sent into the shell.

further: I THINK this causes another issue.

Open a terminal (say Ubuntu) via right-click and start typing. You THINK you are typing into the shell but (I guess it depends on what you type..) you end up with multiple terminal windows being opened.
(I can see this happen a lot, but I can't actively cause it. It MAY be a first-time-after-boot issue...)

Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)?

@transentia commented on GitHub (May 21, 2021): I believe that I am seeing this on: ``` Windows Terminal Preview Version: 1.8.1032.0 Windows: 19042.985 ``` The terminal opens, the cursor blinks but nothing is actually sent into the shell. further: I THINK this causes another issue. Open a terminal (say Ubuntu) via right-click and start typing. You THINK you are typing into the shell but (I guess it depends on what you type..) you end up with multiple terminal windows being opened. (I can see this happen a lot, but I can't actively cause it. It MAY be a first-time-after-boot issue...) Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)?
Author
Owner

@HeinziAT commented on GitHub (Jul 9, 2021):

Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)?

I can reliably reproduce this issue (Windows Terminal 1.8.1521.0, Windows 10 21H1 19043.1083).

This is especially annoying if you right-click to start an ssh session and then, after hitting Enter, you discover that you just entered your top-secret password "somewhere else".

Note: This seems suspiciously similar to this msrdp issue. In particular, focus still seems to be in the task bar, since typing "space" or "enter" will open another Windows Terminal instance.

@HeinziAT commented on GitHub (Jul 9, 2021): > Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)? I can reliably reproduce this issue (Windows Terminal 1.8.1521.0, Windows 10 21H1 19043.1083). This is especially annoying if you right-click to start an ssh session and then, after hitting Enter, you discover that you just entered your top-secret password "somewhere else". Note: This seems suspiciously similar to [this msrdp issue](https://superuser.com/q/1571952/14517). In particular, focus still seems to be in the task bar, since typing "space" or "enter" will open another Windows Terminal instance.
Author
Owner

@kishore-kal commented on GitHub (Jul 11, 2021):

Windows Terminal Preview
Version: 1.9.1523.0

Edition: Windows 10 Home Single Language
Version: 21H1
OS build: 19043.1083

I was able to reproduce this issue with Windows Terminal and other apps (Firefox Developer Edition & Visual Studio Code)

Note: Highlighted category on the menu does not focus the window

Windows Terminal

terminal

Firefox Developer Edition

firefox

Visual Studio Code

vscode

@kishore-kal commented on GitHub (Jul 11, 2021): ``` Windows Terminal Preview Version: 1.9.1523.0 Edition: Windows 10 Home Single Language Version: 21H1 OS build: 19043.1083 ``` I was able to reproduce this issue with Windows Terminal and other apps (Firefox Developer Edition & Visual Studio Code) Note: Highlighted category on the menu does not focus the window ### Windows Terminal ![terminal](https://user-images.githubusercontent.com/21199137/125206526-66f8e180-e2a5-11eb-82bd-b1628ce5b515.jpg) ### Firefox Developer Edition ![firefox](https://user-images.githubusercontent.com/21199137/125206539-79731b00-e2a5-11eb-83d4-cfb78dc7f14c.jpg) ### Visual Studio Code ![vscode](https://user-images.githubusercontent.com/21199137/125206819-c2779f00-e2a6-11eb-8fb1-1daebffc9281.jpg)
Author
Owner

@Turbulentarius commented on GitHub (Jan 3, 2022):

It seem to happen with a lot of apps, including Google Chrome.

Someone mentioned that Edge is causing it, and uninstalling it might fix it; but I am not interested in trying that, since I might need it for testing, and also, Windows Update will probably just forcefully re-install it against my will anyway.

OS build: 19044.1415

Edit: just attempted the "uninstall Edge fix", and restarted the system, but that did not solve it for me. The fix is discussed here: https://www.tenforums.com/browsers-email/161873-browser-edge-firefox-loses-focus-when-opening-through-taskbar.html

Edit 2: Manually updating to Windows 11 appears to solve the problem, but it totally breaks the taskbar functionality. No drag & drop, and no moving the taskbar to the left of the screen anymore — safe to say, Windows 11 got released on Desktop prematurely.

@Turbulentarius commented on GitHub (Jan 3, 2022): It seem to happen with a lot of apps, including **Google Chrome**. Someone mentioned that **Edge** is causing it, and uninstalling it might fix it; but I am not interested in trying that, since I might need it for testing, and also, Windows Update will probably just forcefully re-install it against my will anyway. OS build: 19044.1415 **Edit:** just attempted the "uninstall Edge fix", and restarted the system, but that did not solve it for me. The fix is discussed here: https://www.tenforums.com/browsers-email/161873-browser-edge-firefox-loses-focus-when-opening-through-taskbar.html **Edit 2:** Manually updating to Windows 11 appears to solve the problem, but it totally breaks the taskbar functionality. No drag & drop, and no moving the taskbar to the left of the screen anymore — safe to say, Windows 11 got released on Desktop prematurely.
Author
Owner

@zadjii-msft commented on GitHub (Aug 21, 2023):

You know, is this still happening on Terminal 1.18 and Windows 11/? There's been an enormous amount of changes in both those codebases in the last 2.5 years since this was filed. I'm still fairly confident that this was ultimately a bug in the Taskbar's code. There's also been a tremendous process model refactor for the Terminal since then too.

There's also a similar thread (#13388) that seems like it mostly came down to some sort of 3p privilege management (namely, BeyondTrust) that would steal focus. That though shouldn't have started until 1.14 (long after this was filed).

There's also (tracked elsewhere) the well-known bug that starting WSLg will steal focus initially.

@zadjii-msft commented on GitHub (Aug 21, 2023): You know, is this still happening on Terminal 1.18 and Windows 11/? There's been an enormous amount of changes in both those codebases in the last 2.5 years since this was filed. I'm still fairly confident that this was ultimately a bug in the Taskbar's code. There's also been a tremendous process model refactor for the Terminal since then too. There's also a similar thread (#13388) that seems like it mostly came down to some sort of 3p privilege management (namely, BeyondTrust) that would steal focus. That though shouldn't have started until 1.14 (long after this was filed). There's also (tracked elsewhere) the well-known bug that starting WSLg will steal focus initially.
Author
Owner

@HeinziAT commented on GitHub (Aug 21, 2023):

You know, is this still happening on Terminal 1.18 and Windows 11?

I cannot reproduce this issue any more (probably since upgrading to Windows 11 a few weeks ago). EDIT: Not true, see below.

@HeinziAT commented on GitHub (Aug 21, 2023): > You know, is this still happening on Terminal 1.18 and Windows 11? ~~I cannot reproduce this issue any more (probably since upgrading to Windows 11 a few weeks ago).~~ EDIT: Not true, see below.
Author
Owner

@transentia commented on GitHub (Aug 22, 2023):

I have:
Version: 1.18.1462.0
Windows: 2261.2134

image

If I select the "Windows PowerShell" entry, the terminal window appears and HAS focus.
"AlmaLinux9" appears but does NOT have focus until I click in the window. The window colour is the unfocused colour.

If I start "Windows PowerShell", then start "AlmaLinux9", Alma comes up in a new window which DOES have focus.

@transentia commented on GitHub (Aug 22, 2023): I have: Version: 1.18.1462.0 Windows: 2261.2134 <img width="239" alt="image" src="https://github.com/microsoft/terminal/assets/105110/a89f1570-86a9-4132-a7cd-5b81a36fea08"> If I select the "Windows PowerShell" entry, the terminal window appears and HAS focus. "AlmaLinux9" appears but does NOT have focus until I click in the window. The window colour is the unfocused colour. If I start "Windows PowerShell", then start "AlmaLinux9", Alma comes up in a new window which DOES have focus.
Author
Owner

@transentia commented on GitHub (Aug 22, 2023):

Hmmm.

If I start "Windows PowerShell", then take the focus away from the window (click on desktop) and then start "AlmaLinux9", Alma comes up in a new window which does NOT have focus.

@transentia commented on GitHub (Aug 22, 2023): Hmmm. If I start "Windows PowerShell", then take the focus away from the window (click on desktop) and then start "AlmaLinux9", Alma comes up in a new window which does NOT have focus.
Author
Owner

@Turbulentarius commented on GitHub (Aug 22, 2023):

Of course now we have a much worse issue; the task bar in Windows 11 is
severely nerfed. I seriously had to replace it with a patched / replaced
shell, ExplorerPatcher, just to be able to move the damn thing to the right
of the screen.

On Tue, Aug 22, 2023 at 2:17 AM transentia @.***> wrote:

Hmmm.

If I start "Windows PowerShell", then take the focus away from the window
(click on desktop) and then start "AlmaLinux9", Alma comes up in a new
window which does NOT have focus.


Reply to this email directly, view it on GitHub
https://github.com/microsoft/terminal/issues/8720#issuecomment-1687230383,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHRXUI3OVAPPY2MH3EHCAWTXWP3DBANCNFSM4VZITXTQ
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

@Turbulentarius commented on GitHub (Aug 22, 2023): Of course now we have a much worse issue; the task bar in Windows 11 is severely nerfed. I seriously had to replace it with a patched / replaced shell, ExplorerPatcher, just to be able to move the damn thing to the right of the screen. On Tue, Aug 22, 2023 at 2:17 AM transentia ***@***.***> wrote: > Hmmm. > > If I start "Windows PowerShell", then take the focus away from the window > (click on desktop) and then start "AlmaLinux9", Alma comes up in a new > window which does NOT have focus. > > — > Reply to this email directly, view it on GitHub > <https://github.com/microsoft/terminal/issues/8720#issuecomment-1687230383>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AHRXUI3OVAPPY2MH3EHCAWTXWP3DBANCNFSM4VZITXTQ> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
Author
Owner

@HeinziAT commented on GitHub (Aug 22, 2023):

After trying it again, I can confirm transentia's observation: "Command Prompt" and "Powershell" keep focus, the behavior for WSL is... erratic: Yesterday, "Ubuntu" kept focus and my custom ssh profile lost focus, today it's the other way around.

@HeinziAT commented on GitHub (Aug 22, 2023): After trying it again, I can confirm transentia's observation: "Command Prompt" and "Powershell" keep focus, the behavior for WSL is... erratic: Yesterday, "Ubuntu" kept focus and my custom ssh profile lost focus, today it's the other way around.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2023):

Okay, thanks for the follow-ups. That all sounds like the WSL focus thing (which itself is pretty erratic in my experience). We'll close this out on our side. I'm honestly not sure where the WSL thread is - I've looked for it for a while now but seemingly can't find the right one.

@zadjii-msft commented on GitHub (Aug 22, 2023): Okay, thanks for the follow-ups. That all sounds like the WSL focus thing (which itself is pretty erratic in my experience). We'll close this out on our side. I'm honestly not sure where the WSL thread is - I've looked for it for a while now but seemingly can't find the right one.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2023):

update: I'm told it's

@zadjii-msft commented on GitHub (Aug 22, 2023): update: I'm told it's * https://github.com/microsoft/wslg/issues/895 * https://github.com/microsoft/wslg/issues/894 * There's apparently not an internal work item, but I'm _told_ that it's fixed in newer [msrdc versions](https://learn.microsoft.com/en-us/azure/virtual-desktop/whats-new-client-windows). * > it should be in 1.2.4234 or newer _apparently_ * you can check that with `wsl --version`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11985