microsoft / microsoft/terminal

[Bug] "Open in Terminal" focuses on last session instead of selected folder

Open
#18,036 0 comments 0 reactions 0 assignees View on GitHub
Area-Windowing Issue-Bug Priority-3 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

7.4.5

### Windows build number

22631.4317

### Other Software

Using Terminal in combination with File Explorer has a certain risk. When you have closed Terminal with open sessions, it will focus on the last session NO MATTER how you have started Terminal again. Literally focusing on a session open in folder A, even though Terminal was started by the user telling it to open a new session in folder X. When you don't know this and start typing your commands right away without checking you might end up destroying your data depending on the operations you do. I happened to me in a hurry. It destroys your workflow. It opens two Terminal windows, one with the old sessions and a new window with the new session you've openend via the Explorer, but for some stupid reason the former gets the focus.

### Steps to reproduce

- Open a few sessions in folders A, B, C.
- Close Terminal
- Use File Explorer to "Open in Terminal" folder X
- There a now two Terminal windows, and focus is on the one with the old sessions instead of the session you have started Terminal again for

### Expected Behavior

Open one Terminal window, add the new session to it, and give it focus. Or open two Terimal windows, the old session and in addition a new window with the new session that you actually want to work in, but focus on the latter.

### Actual Behavior

Old session steals the focus, you have to manually switch to the session you have just started with "Open in Terminal".

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Reproduce on Windows Terminal 7.4.5 and Windows build 22631.4317 by restoring sessions, closing Terminal, then using File Explorer's “Open in Terminal” on another folder. Done means the newly opened session receives focus, whether it is added to one window or opened in a second window.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.