Terminal shouldn't be offered as an option in the context menu for Quick Access background #16874

Closed
opened 2026-01-31 05:25:47 +00:00 by claunia · 15 comments
Owner

Originally created by @zadjii-msft on GitHub (Feb 25, 2022).

From MSFT:37831236

When I right-click on the background of File Explorer "Quick Access," Terminal shouldn't be offered as an option because it doesn't do anything there

Presumably we can filter if we're visible based on the path that was provided to us.

Originally created by @zadjii-msft on GitHub (Feb 25, 2022). From MSFT:37831236 > When I right-click on the background of File Explorer "Quick Access," Terminal shouldn't be offered as an option because it doesn't do anything there Presumably we can filter if we're visible based on the path that was provided to us.
Author
Owner

@zadjii-msft commented on GitHub (Feb 25, 2022):

From internal mail:

So, in their IExplorerCommand::GetState, I think they could have a check for that against the IShellItemArray that gets passed in.

bool IsFileSystemItem(IShellItem* shellItem)
{
    SFGAOF attributes;
    return (shellItem->GetAttributes(SFGAO_FILESYSTEM, &attributes) == S_OK);
}

We may also want to compare notes with MSFT:36909951

@zadjii-msft commented on GitHub (Feb 25, 2022): From internal mail: > So, in their `IExplorerCommand::GetState`, I think they could have a check for that against the `IShellItemArray` that gets passed in. ```c++ bool IsFileSystemItem(IShellItem* shellItem) { SFGAOF attributes; return (shellItem->GetAttributes(SFGAO_FILESYSTEM, &attributes) == S_OK); } ``` We may also want to compare notes with MSFT:36909951
Author
Owner

@Shomnipotence commented on GitHub (Feb 26, 2022):

Open with... dialog cannot choose the All the Apps from Microsoft Store

@Shomnipotence commented on GitHub (Feb 26, 2022): Open with... dialog cannot choose the All the Apps from Microsoft Store
Author
Owner

@ghost commented on GitHub (Jul 6, 2022):

:tada:This issue was addressed in #13206, which has now been successfully released as Windows Terminal v1.14.186.🎉

Handy links:

@ghost commented on GitHub (Jul 6, 2022): :tada:This issue was addressed in #13206, which has now been successfully released as `Windows Terminal v1.14.186`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.14.186) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Jul 6, 2022):

:tada:This issue was addressed in #13206, which has now been successfully released as Windows Terminal Preview v1.15.186.🎉

Handy links:

@ghost commented on GitHub (Jul 6, 2022): :tada:This issue was addressed in #13206, which has now been successfully released as `Windows Terminal Preview v1.15.186`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.15.186) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Aug 18, 2022):

:tada:This issue was addressed in #13206, which has now been successfully released as Windows Terminal v1.14.228.🎉

Handy links:

@ghost commented on GitHub (Aug 18, 2022): :tada:This issue was addressed in #13206, which has now been successfully released as `Windows Terminal v1.14.228`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.14.228) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Aug 18, 2022):

:tada:This issue was addressed in #13206, which has now been successfully released as Windows Terminal Preview v1.15.228.🎉

Handy links:

@ghost commented on GitHub (Aug 18, 2022): :tada:This issue was addressed in #13206, which has now been successfully released as `Windows Terminal Preview v1.15.228`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.15.228) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@zadjii-msft commented on GitHub (Aug 18, 2022):

Lol the bot thought that it should comment here because of the revert 😅

I'm reopening this cause we reverted this to fix #13523. I think there's an OS bug, at least on Windows 11, that doesn't let us know the difference between "My PC" and the desktop background. Both show up with an empty array and a null path from explorer. So that's useless.

@zadjii-msft commented on GitHub (Aug 18, 2022): Lol the bot thought that it should comment here because of the revert 😅 I'm reopening this cause we reverted this to fix #13523. I think there's an OS bug, at least on Windows 11, that doesn't let us know the difference between "My PC" and the desktop background. Both show up with an empty array and a null path from explorer. So that's useless.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2022):

Upstream issue is now MSFT:41029797

@zadjii-msft commented on GitHub (Aug 22, 2022): Upstream issue is now MSFT:41029797
Author
Owner

@leejy12 commented on GitHub (Sep 7, 2022):

Regarding https://github.com/microsoft/terminal/issues/13523

The reason that "Open in Terminal" isn't shown consistently when desktop is right clicked is that on Windows 11, the default context menu is made of fancy XAML controls, and the Window Class name of the foreground window is sometimes reported as XamlExplorerHostIslandWindow, not Progman or WorkerW.

In OpenTerminalHere::_GetPathFromExplorer(), I think we can add an additional check to work around this issue.

if (0 == StrCmp(szName, L"WorkerW") ||
    0 == StrCmp(szName, L"Progman") ||
    0 == StrCmp(szName, L"XamlExplorerHostIslandWindow"))

From https://github.com/microsoft/terminal/pull/13206#issuecomment-1217094214

Okay I'm pretty sure this caused #13523. Turns out that there's a non-zero rate of the shell giving us 0 items in the array. I can check for that easy enough, but it seems like still returning ECS_HIDDEN for that results in the menu entry not always appearing for the desktop.

I'll need to noodle more

Is there a way to reproduce the case where psiItemArray is not nullptr but psiItemArray->GetCount returns 0? (I assume this is why OpenTerminalHere::GetState() was crashing often). I've never succeeded in observing this behavior.

Also, the PR that originally fixed this issue was reverted in the internal repo, right? Will the revert make its way to this public repo?

@leejy12 commented on GitHub (Sep 7, 2022): Regarding https://github.com/microsoft/terminal/issues/13523 The reason that "Open in Terminal" isn't shown consistently when desktop is right clicked is that on Windows 11, the default context menu is made of fancy XAML controls, and the Window Class name of the foreground window is sometimes reported as `XamlExplorerHostIslandWindow`, not `Progman` or `WorkerW`. In `OpenTerminalHere::_GetPathFromExplorer()`, I think we can add an additional check to work around this issue. ``` if (0 == StrCmp(szName, L"WorkerW") || 0 == StrCmp(szName, L"Progman") || 0 == StrCmp(szName, L"XamlExplorerHostIslandWindow")) ``` From https://github.com/microsoft/terminal/pull/13206#issuecomment-1217094214 > Okay I'm pretty sure this caused #13523. Turns out that there's a non-zero rate of the shell giving us 0 items in the array. I can check for that easy enough, but it seems like still returning ECS_HIDDEN for that results in the menu entry not always appearing for the desktop. > > I'll need to noodle more Is there a way to reproduce the case where `psiItemArray` is not `nullptr` but `psiItemArray->GetCount` returns 0? (I assume this is why `OpenTerminalHere::GetState()` was crashing often). I've never succeeded in observing this behavior. Also, the [PR](https://github.com/microsoft/terminal/pull/13206) that originally fixed this issue was reverted in the internal repo, right? Will the revert make its way to this public repo?
Author
Owner

@DHowett commented on GitHub (Sep 7, 2022):

Also, the https://github.com/microsoft/terminal/pull/13206 that originally fixed this issue was reverted in the internal repo, right? Will the revert make its way to this public repo?

This PR The revert was made against and merged into the public repository. There is no private/internal copy of the Windows Terminal source; we do all development right out here in the open! 😄

Edited to correct for me having misread your question. The commit that reverts it is 2d00432da on release-1.14 and 76daf71cf on release-1.15. We kept it on in main so we could have builds to repro the issue with.

@DHowett commented on GitHub (Sep 7, 2022): > Also, the https://github.com/microsoft/terminal/pull/13206 that originally fixed this issue was reverted in the internal repo, right? Will the revert make its way to this public repo? ~~This PR~~ The revert was made against and merged into the public repository. There is no private/internal copy of the Windows Terminal source; we do all development right out here in the open! :smile: Edited to correct for me having misread your question. The commit that reverts it is 2d00432da on `release-1.14` and 76daf71cf on `release-1.15`. We kept it on in `main` so we could have builds to repro the issue with.
Author
Owner

@DHowett commented on GitHub (Sep 7, 2022):

Good find on the Xaml...Window thing! Do you think that the rest of the explorer lookup logic will work with that HWND as well?

@DHowett commented on GitHub (Sep 7, 2022): Good find on the `Xaml...Window` thing! Do you think that the rest of the explorer lookup logic will work with that HWND as well?
Author
Owner

@leejy12 commented on GitHub (Sep 7, 2022):

Edited to correct for me having misread your question. The commit that reverts it is 2d00432dab on release-1.14 and 76daf71cf9 on release-1.15. We kept it on in main so we could have builds to repro the issue with.

Thanks for the clarification!

Good find on the Xaml...Window thing! Do you think that the rest of the explorer lookup logic will work with that HWND as well?

I think so. Even when the context menu is open in Explorer, the foreground window's class name is always reported as CabinetWClass.

@leejy12 commented on GitHub (Sep 7, 2022): > Edited to correct for me having misread your question. The commit that reverts it is https://github.com/microsoft/terminal/commit/2d00432dab82f1d46d8cdc9176d5e3e6f34f753a on release-1.14 and https://github.com/microsoft/terminal/commit/76daf71cf96f81a6e0589bdef4f01d325c7e7847 on release-1.15. We kept it on in main so we could have builds to repro the issue with. Thanks for the clarification! > Good find on the `Xaml...Window` thing! Do you think that the rest of the explorer lookup logic will work with that HWND as well? I think so. Even when the context menu is open in Explorer, the foreground window's class name is always reported as `CabinetWClass`.
Author
Owner

@ghost commented on GitHub (Sep 23, 2022):

:tada:This issue was addressed in #14048, which has now been successfully released as Windows Terminal Preview v1.16.2641.0.🎉

Handy links:

@ghost commented on GitHub (Sep 23, 2022): :tada:This issue was addressed in #14048, which has now been successfully released as `Windows Terminal Preview v1.16.2641.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.16.2641.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Oct 18, 2022):

:tada:This issue was addressed in #14048, which has now been successfully released as Windows Terminal v1.15.2874.🎉

Handy links:

@ghost commented on GitHub (Oct 18, 2022): :tada:This issue was addressed in #14048, which has now been successfully released as `Windows Terminal v1.15.2874`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.15.2874) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Dec 14, 2022):

:tada:This issue was addressed in #14048, which has now been successfully released as Windows Terminal Preview v1.16.3463.0 and v1.16.3464.0.🎉

Handy links:

@ghost commented on GitHub (Dec 14, 2022): :tada:This issue was addressed in #14048, which has now been successfully released as `Windows Terminal Preview v1.16.3463.0 and v1.16.3464.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.16.3464.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16874