New window is opened in background #20419

Closed
opened 2026-01-31 07:13:11 +00:00 by claunia · 18 comments
Owner

Originally created by @oldium on GitHub (Aug 29, 2023).

Windows Terminal version

1.18.1462.0

Windows build number

10.0.22621.0

Other Software

No response

Steps to reproduce

  1. Open File Explorer, place it on the screen so that new Windows Terminal window must open over it.
  2. On address bar of File Explorer, write wt and press Enter.
  3. New Windows Terminal window opens in front of other windows and gets focus.
  4. Switch back to File Explorer's address bar, write wt and press Enter.
  5. New Windows Terminal window opens in front of other windows and gets focus.
  6. Click on the first Windows Terminal window's title bar.
  7. Switch back to File Explorer's address bar, write wt and press Enter.
  8. Observe that the Windows Terminal window is opened in background (not over File Explorer, but below it), has blinking cursor like it has focus, but it does not have focus.

Expected Behavior

The new window is opened in foreground and gets focus.

Actual Behavior

The new window is not a foreground window and does not have focus.

The new window is opened in foreground as long as you do not click on any previously opened window. When you do, next Windows Terminal window (and any further) opens in background.

Originally created by @oldium on GitHub (Aug 29, 2023). ### Windows Terminal version 1.18.1462.0 ### Windows build number 10.0.22621.0 ### Other Software _No response_ ### Steps to reproduce 1. Open File Explorer, place it on the screen so that new Windows Terminal window must open over it. 2. On address bar of File Explorer, write `wt` and press Enter. 3. New Windows Terminal window opens in front of other windows and gets focus. 4. Switch back to File Explorer's address bar, write `wt` and press Enter. 5. New Windows Terminal window opens in front of other windows and gets focus. 6. Click on the first Windows Terminal window's title bar. 7. Switch back to File Explorer's address bar, write `wt` and press Enter. 8. Observe that the Windows Terminal window is opened in background (not over File Explorer, but below it), has blinking cursor like it has focus, but it does not have focus. ### Expected Behavior The new window is opened in foreground and gets focus. ### Actual Behavior The new window is not a foreground window and does not have focus. The new window is opened in foreground as long as you do _not_ click on any previously opened window. When you do, next Windows Terminal window (and any further) opens in background.
Author
Owner

@lhecker commented on GitHub (Aug 30, 2023):

Hey! Thanks for the report. This appears to be /duplicate of #15763. 🙂

@lhecker commented on GitHub (Aug 30, 2023): Hey! Thanks for the report. This appears to be /duplicate of #15763. 🙂
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Aug 30, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Aug 30, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@oldium commented on GitHub (Sep 1, 2023):

Hey! Thanks for the report. This appears to be /duplicate of #15763. 🙂

@lhecker I do not have problem with Alt-Tab. I have problem with the window opened in background. I do not think this is a duplicate.

@oldium commented on GitHub (Sep 1, 2023): > Hey! Thanks for the report. This appears to be /duplicate of #15763. 🙂 @lhecker I do not have problem with Alt-Tab. I have problem with the window opened in background. I do not think this is a duplicate.
Author
Owner

@lhecker commented on GitHub (Sep 1, 2023):

Oh you're right. (Although I do think they're related.)
But there are multiple other reports of this issue like for instance #13130. I think something's wrong with bringing packaged applications (AppX/MSIX) to the foreground in general. Internally Windows is littered with special handlings for packaged applications throughout the code base so it at least wouldn't be entirely surprising to me if it deviated from the behavior of regular applications.

@lhecker commented on GitHub (Sep 1, 2023): Oh you're right. (Although I do think they're related.) But there are multiple other reports of this issue like for instance #13130. I think something's wrong with bringing packaged applications (AppX/MSIX) to the foreground in general. Internally Windows is littered with special handlings for packaged applications throughout the code base so it at least wouldn't be entirely surprising to me if it deviated from the behavior of regular applications.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Sep 2, 2023):

This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.

@microsoft-github-policy-service[bot] commented on GitHub (Sep 2, 2023): This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
Author
Owner

@lhecker commented on GitHub (Nov 16, 2023):

I didn't notice that this issue was closed again. I'll reopen it. I don't really think it's the exact same issue as the other one...

@lhecker commented on GitHub (Nov 16, 2023): I didn't notice that this issue was closed again. I'll reopen it. I don't really think it's the exact same issue as the other one...
Author
Owner

@zadjii-msft commented on GitHub (Nov 29, 2023):

This is the "wt.exe should probably AllowSetForeground / CoAllowSetForeground on the monarch" thing.

@zadjii-msft commented on GitHub (Nov 29, 2023): This is the "`wt.exe` should probably `AllowSetForeground` / `CoAllowSetForeground` on the monarch" thing.
Author
Owner

@KerimG commented on GitHub (Dec 4, 2023):

I ahve been having this issue for a couple weeks too now. I'm opening the Windows Terminal by pressing the Win button to open the start menu and type "Terminal". I think the problem occurs if the Windows Terminal app is pinned to the task bar.

EDIT: This is incorrect.

@KerimG commented on GitHub (Dec 4, 2023): I ahve been having this issue for a couple weeks too now. I'm opening the Windows Terminal by pressing the Win button to open the start menu and type "Terminal". I think the problem occurs if the Windows Terminal app is pinned to the task bar. EDIT: This is incorrect.
Author
Owner

@willuhn commented on GitHub (Dec 4, 2023):

I'm having the same issue, not related to pinned task bar here. I'm starting wt.exe using an autohotkey script. Terminal windows randomly appears in background.

@willuhn commented on GitHub (Dec 4, 2023): I'm having the same issue, not related to pinned task bar here. I'm starting wt.exe using an autohotkey script. Terminal windows randomly appears in background.
Author
Owner

@KerimG commented on GitHub (Dec 4, 2023):

@willuhn you're correct, after working for a while I just had the same issue again.

@KerimG commented on GitHub (Dec 4, 2023): @willuhn you're correct, after working for a while I *just* had the same issue again.
Author
Owner

@Cyanide0210 commented on GitHub (Feb 28, 2024):

Its always appearing on the background for me, I do not like that at all

@Cyanide0210 commented on GitHub (Feb 28, 2024): Its always appearing on the background for me, I do not like that at all
Author
Owner

@MaverickMartyn commented on GitHub (Mar 8, 2024):

I too have this issue.
In my case I use PowerToys Keyboard Manager to launch C:\Users\USER\AppData\Local\Microsoft\WindowsApps\wt.exe
I do not have Terminal pinned to the taskbar, and it happens to the first create Window, not just any subsequent ones.
Here's my launch settings, in case that matters:
(EDIT: I am currently running version 1.19.10573.0. I believe that was also the case when I originally commented.)
image

@MaverickMartyn commented on GitHub (Mar 8, 2024): I too have this issue. In my case I use PowerToys Keyboard Manager to launch C:\Users\USER\AppData\Local\Microsoft\WindowsApps\wt.exe I do not have Terminal pinned to the taskbar, and it happens to the first create Window, not just any subsequent ones. Here's my launch settings, in case that matters: (EDIT: I am currently running version 1.19.10573.0. I believe that was also the case when I originally commented.) ![image](https://github.com/microsoft/terminal/assets/2946618/99dc5ee4-1cfc-4407-9c9d-7a37ad908040)
Author
Owner

@ghost commented on GitHub (Apr 2, 2024):

I used to have this issue until I updated to 1.19.10821.0 via Winget. From memory, I used Microsoft Store to get WT at first. I open WT via the context menu (right click → t) and a shortcut on my desktop mapped to a keybind. I'm on Windows 10 22H2 build 19045.4170. I feel like this issue is either contextual (the fix seems to persist through restarts though) or resolved.

@ghost commented on GitHub (Apr 2, 2024): I used to have this issue until I updated to 1.19.10821.0 via Winget. From memory, I used Microsoft Store to get WT at first. I open WT via the context menu (right click → t) and a shortcut on my desktop mapped to a keybind. I'm on Windows 10 22H2 build 19045.4170. I feel like this issue is either contextual (the fix seems to persist through restarts though) or resolved.
Author
Owner

@McSneaky commented on GitHub (Apr 11, 2024):

Have version 1.19.10821.0 installed thro Microsoft Store and it has been happening for months. Still happening

Doesn't matter how I open terminal, always goes to background

@McSneaky commented on GitHub (Apr 11, 2024): Have version 1.19.10821.0 installed thro Microsoft Store and it has been happening for months. Still happening Doesn't matter how I open terminal, always goes to background
Author
Owner

@zadjii-msft commented on GitHub (Aug 29, 2024):

fwiw I can't repro this on 10.0.26282.5000 & 1.23.2391.0. This may have been fixed by #17368 in 1.22 Preview - can anyone confirm/?

@zadjii-msft commented on GitHub (Aug 29, 2024): fwiw I can't repro this on `10.0.26282.5000` & ` 1.23.2391.0`. This may have been fixed by #17368 in 1.22 Preview - can anyone confirm/?
Author
Owner

@oldium commented on GitHub (Sep 3, 2024):

Yeah! I can confirm it works for me with version 1.21.1772.0 on Win 11 22631.4112.

@oldium commented on GitHub (Sep 3, 2024): Yeah! I can confirm it works for me with version 1.21.1772.0 on Win 11 22631.4112.
Author
Owner

@oldium commented on GitHub (Sep 3, 2024):

fwiw I can't repro this on 10.0.26282.5000 & 1.23.2391.0. This may have been fixed by #17368 in 1.22 Preview - can anyone confirm/?

I am on version which you have not mentioned, which is really strange, but with 1.21.1772.0 it works for me. I tried exactly the repro steps and also my usual work flow, it works. It might be working for longer time, I just have not noticed it.

@oldium commented on GitHub (Sep 3, 2024): > fwiw I can't repro this on `10.0.26282.5000` & ` 1.23.2391.0`. This may have been fixed by #17368 in 1.22 Preview - can anyone confirm/? I am on version which you have not mentioned, which is really strange, but with 1.21.1772.0 it works for me. I tried exactly the repro steps and also my usual work flow, it works. It might be working for longer time, I just have not noticed it.
Author
Owner

@oldium commented on GitHub (Sep 14, 2024):

Works for me, closing.

@oldium commented on GitHub (Sep 14, 2024): Works for me, closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20419