Skip to content
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

New window is opened in background #15895

Closed
Tracked by #14957
oldium opened this issue Aug 29, 2023 · 18 comments
Closed
Tracked by #14957

New window is opened in background #15895

oldium opened this issue Aug 29, 2023 · 18 comments
Labels
Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Milestone

Comments

@oldium
Copy link

oldium commented 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.

@oldium oldium added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Aug 29, 2023
@lhecker
Copy link
Member

lhecker commented Aug 30, 2023

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

@microsoft-github-policy-service
Copy link
Contributor

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 microsoft-github-policy-service bot added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Aug 30, 2023
@oldium
Copy link
Author

oldium commented 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.

@lhecker
Copy link
Member

lhecker commented 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 lhecker reopened this Sep 1, 2023
@lhecker lhecker added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Sep 1, 2023
@microsoft-github-policy-service
Copy link
Contributor

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

@lhecker
Copy link
Member

lhecker commented 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 lhecker removed the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Nov 16, 2023
@lhecker lhecker reopened this Nov 16, 2023
@lhecker lhecker added the Needs-Attention The core contributors need to come back around and look at this ASAP. label Nov 16, 2023
@zadjii-msft
Copy link
Member

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

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. Area-Windowing Window frame, quake mode, tearout and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Nov 29, 2023
@zadjii-msft zadjii-msft added this to the Backlog milestone Nov 29, 2023
@KerimG
Copy link

KerimG commented 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.

@willuhn
Copy link

willuhn commented 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.

@KerimG
Copy link

KerimG commented Dec 4, 2023

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

@Cyanide0210
Copy link

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

@MaverickMartyn
Copy link

MaverickMartyn commented 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

@jackharro
Copy link

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.

@McSneaky
Copy link

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

github-merge-queue bot pushed a commit that referenced this issue Jun 10, 2024
Sometimes subsequent WT windows open in the background behind other
applications. This PR tries to fix it.

Refs #15895
Refs #15479

Mysterious bug (and annoying). There are even some discussions about
happening to the first startup, not just subsequent ones. Sometimes the
window may show up without animation too. So I don't think this is the
final solution, but it did get solved on my computer, for now.

## Validation Steps Performed
0. Quit all WT windows if some.
1. Open File Explorer, click "Open in Terminal" in context menu.
2. Move the newly opened window and minimize it.
3. Back to step 1 and repeat several times.
4. All the windows should open in the foreground correctly (yet possibly
without animation).

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
DHowett pushed a commit that referenced this issue Jun 24, 2024
Sometimes subsequent WT windows open in the background behind other
applications. This PR tries to fix it.

Refs #15895
Refs #15479

Mysterious bug (and annoying). There are even some discussions about
happening to the first startup, not just subsequent ones. Sometimes the
window may show up without animation too. So I don't think this is the
final solution, but it did get solved on my computer, for now.

## Validation Steps Performed
0. Quit all WT windows if some.
1. Open File Explorer, click "Open in Terminal" in context menu.
2. Move the newly opened window and minimize it.
3. Back to step 1 and repeat several times.
4. All the windows should open in the foreground correctly (yet possibly
without animation).

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
(cherry picked from commit c52ba7d)
Service-Card-Id: 92715122
Service-Version: 1.21
DHowett pushed a commit that referenced this issue Jun 26, 2024
Sometimes subsequent WT windows open in the background behind other
applications. This PR tries to fix it.

Refs #15895
Refs #15479

Mysterious bug (and annoying). There are even some discussions about
happening to the first startup, not just subsequent ones. Sometimes the
window may show up without animation too. So I don't think this is the
final solution, but it did get solved on my computer, for now.

## Validation Steps Performed
0. Quit all WT windows if some.
1. Open File Explorer, click "Open in Terminal" in context menu.
2. Move the newly opened window and minimize it.
3. Back to step 1 and repeat several times.
4. All the windows should open in the foreground correctly (yet possibly
without animation).

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
(cherry picked from commit c52ba7d)
Service-Card-Id: 92715121
Service-Version: 1.20
@zadjii-msft
Copy link
Member

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/?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Aug 29, 2024
@oldium
Copy link
Author

oldium commented Sep 3, 2024

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

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Sep 3, 2024
@oldium
Copy link
Author

oldium commented 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
Copy link
Author

oldium commented Sep 14, 2024

Works for me, closing.

@oldium oldium closed this as completed Sep 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

9 participants