Fix: Select files when using "Open in folder" from Chromium browsers - #18784
Fix: Select files when using "Open in folder" from Chromium browsers#187840x5bfa wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows “Open in folder” launcher integration so that when Chromium-based browsers call SHOpenFolderAndSelectItems, Files can provide the necessary shell-view hooks (e.g., IWebBrowserApp::get_Document → IServiceProvider::QueryService → IShellView::SelectItem) and ultimately launch Files with -select so the target item is scrolled to and selected (matching File Explorer behavior).
Changes:
- Extend
OpenInFolderto implementIWebBrowserApp,IServiceProvider, andIShellViewso the shell can callSelectItemand provide the selected item back to the launcher. - Register the launcher window with
IShellWindows::RegisterPending+Register, and triggerOnNavigateto support shell navigation/select flows. - Adjust launcher window creation to use a cloaked, non-activating tool window (instead of a message-only window) to better participate in shell window registration.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Files.App.Launcher/OpenInFolder.h | Adds COM interface surface (IWebBrowserApp/IServiceProvider/IShellView) and new state needed to support selection callbacks. |
| src/Files.App.Launcher/OpenInFolder.cpp | Implements COM methods, registers with IShellWindows, and captures selection via IShellView::SelectItem to drive Files -select. |
| src/Files.App.Launcher/FilesLauncher.cpp | Updates hidden window creation/attributes and adjusts the selection-vs-fallback flow when launching Files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ab61fc6fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@0x5bfa this is working on my end. I tested with Edge, Task Manager, and GitHub Desktop. |
Resolved / Related Issues
What we had done previously
The launcher had only handled:
files-dev:?cmd=... -directoryif none foundIShellWindows::RegisterPendingandOnNavigateHowever, Chromium browsers call
windows.storage!SHOpenFolderAndSelectItems, which callsSHOpenOrGetFolderView, which then callsIShellView::SelectItem, meaning it requires a shell view. I also discovered thatSHOpenOrGetFolderViewcallsIWebBrowserApp::get_Documentthen it callsIServiceProvider::QueryServicewithIID_IFolderViewandIID_IShellView.https://github.com/chromium/chromium/blob/d86b833661437c96234c43b172f83561e583ee0d/chrome/browser/platform_util_win.cc#L73-L85
What I have implemented
flowchart LR A[Edge / Chrome] B[SHOpenFolderAndSelectItems] C[RegisterPending / Register] D[IWebBrowserApp::get_Document] E[IServiceProvider::QueryService] F[IShellView::SelectItem] G[Files -select] A --> B -->|Launch the launcher| C --> D --> E --> F -->|Launch Files with -select| GSteps used to test these changes