[PR #8638] make "open terminal here" context menu work for directory background #27266

Open
opened 2026-01-31 09:20:57 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/8638

State: closed
Merged: Yes


This commit makes "Open in Windows Terminal" Context menu work again for
directory background even on system that OS fix is not applied.

This is a fallback solution to OS fixes mentioned in #6414.
While OS fix is on its way, we need a fallback that works on existing OS
versions.

The approach to this is: when no item is selected (nullptr for
IShellItemArray*), we use shell api to query the path of current active
Explorer window. A special case is handled for Windows Desktop. Once
we are able to obtain the path, we launch Windows Terminal with it.

Validation Steps Performed

  1. Right click on desktop to bring up the Context menu, pick "Open in
    Windows Terminal", verify that a terminal is opened with correct
    initial path.

  2. Open a few File Explorer windows, pick any window, navigate to a
    folder, click on "Background" to bring up the context menu, click
    "Open in Windows Terminal" verify that a terminal is opened with
    correct initial path.

Closes #6414

**Original Pull Request:** https://github.com/microsoft/terminal/pull/8638 **State:** closed **Merged:** Yes --- This commit makes "Open in Windows Terminal" Context menu work again for directory background even on system that OS fix is not applied. This is a fallback solution to OS fixes mentioned in #6414. While OS fix is on its way, we need a fallback that works on existing OS versions. The approach to this is: when no item is selected (nullptr for IShellItemArray*), we use shell api to query the path of current active Explorer window. A special case is handled for Windows Desktop. Once we are able to obtain the path, we launch Windows Terminal with it. ## Validation Steps Performed 1. Right click on desktop to bring up the Context menu, pick "Open in Windows Terminal", verify that a terminal is opened with correct initial path. 2. Open a few File Explorer windows, pick any window, navigate to a folder, click on "Background" to bring up the context menu, click "Open in Windows Terminal" verify that a terminal is opened with correct initial path. Closes #6414
claunia added the pull-request label 2026-01-31 09:20:57 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27266