terminal icon indicating copy to clipboard operation
terminal copied to clipboard

New window is opened in background

Open oldium opened this issue 2 years ago • 14 comments

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.

oldium avatar Aug 29 '23 15:08 oldium

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

lhecker avatar Aug 30 '23 21:08 lhecker

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!

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 avatar Sep 01 '23 09:09 oldium

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 avatar Sep 01 '23 09:09 lhecker

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

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 avatar Nov 16 '23 16:11 lhecker

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

zadjii-msft avatar Nov 29 '23 22:11 zadjii-msft

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 avatar Dec 04 '23 09:12 KerimG

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 avatar Dec 04 '23 09:12 willuhn

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

KerimG avatar Dec 04 '23 09:12 KerimG

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

Cyanide0210 avatar Feb 28 '24 10:02 Cyanide0210

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 avatar Mar 08 '24 20:03 MaverickMartyn

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.

jackharro avatar Apr 02 '24 09:04 jackharro

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 avatar Apr 11 '24 12:04 McSneaky

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 avatar Aug 29 '24 18:08 zadjii-msft

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

oldium avatar Sep 03 '24 18:09 oldium

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 avatar Sep 03 '24 18:09 oldium

Works for me, closing.

oldium avatar Sep 14 '24 10:09 oldium