d2phap / ImageGlass

🏞 A lightweight, versatile image viewer
https://imageglass.org
Other
7.35k stars 482 forks source link

Incompatibility with Explorer's search #404

Open bitaruka opened 5 years ago

bitaruka commented 5 years ago

When I open file from Explorer's search results the navigation in ImageGlass is different from search window. Seems it just navigate all images in folder that contain opened file.

Expected behavior: ImageGlass file navigation is the same as I see in search results window.

To reproduce just try to search images through Explorer, then explore results through ImageGlass.

issue3

d2phap commented 5 years ago

Duplication of #139

WasabiWarlord75 commented 3 years ago

It's not a duplicate of #139, the issue still persists.

fire-eggs commented 3 years ago

Yes, search results in explorer is a different beastie.

ravewulf commented 2 years ago

I'm not exactly sure how this is enabled but the expected behavior can be seen with Windows Photo Viewer (the one present since Vista/7, not the Photos app).

Steps:

  1. Use Windows Explorer's search box to filter files (returns filtered results from the current folder and any subfolders) OR open a Saved Search (.search-ms)
  2. (Optional) sort the results
  3. If Windows Photo Viewer is the default image handler, double click on an image. If not, right-click > Open With > Windows Photo Viewer
  4. Use arrow keys to go to next/previous image

Results: Windows Photo Viewer will go to the next/previous image in the search results or Saved Search. This is a flat view of all images that match the search query, regardless of what folder they are in, using the folder that was searched from as the root for additional images.

When repeating the same with ImageGlass (and the "Find images in child folder" option enabled), it uses the folder of the first opened image as the root, rather than the folder that was searched from, and displays all images from that folder and lower, including images that had been filtered out by the search query.

Xelrog commented 2 years ago

Bump. I found another request for this dating 2020, can we please add it soon? Literally the one thing missing from ImageGlass, I hate having to constantly go back to using Windows Photos because of the lack of this basic necessary functionality.

Squarenet commented 2 years ago

Would also like to see this being done. Any plans for doing so?

d2phap commented 2 years ago

Would also like to see this being done. Any plans for doing so?

I haven't found any resources/API to retrieve the search result.

ravewulf commented 2 years ago

I'm not 100% positive but I think it might be related to the IFolderView2 interface

ravewulf commented 2 years ago

IFolderView2::GetItems? It's inherited from IFolderView but, I assume, with the extra stuff from Vista and newer (search folders/search results in an Explorer view). May or may not also need IFolderView2::GetSortColumns depending on if the collection is sorted or not.

I'm primarily a web developer rather than working with Windows apps so I'm not entirely sure but it seems like that should get all the items in the view. Take this with a grain of salt though as I don't have a dev environment to test it out myself.

fire-eggs commented 2 years ago

The guts of the "support Window Explorer sort order" code can be found at:

Doit.cpp

It's in C++ because for the life of me, I could not get the necessary C# bindings to the COM functions to work.

Here is the primary challenge for supporting Search results:

Which Explorer window is ImageGlass supposed to pull the list from?

The current algorithm is:

A known limitation of this algorithm is the first Explorer window pointing at that folder is used. It may not be the window the user actually used to view said image file!

To support Search results will require something like this:

This has the same limitation: the first window containing the full image path in its list of items would be used, not necessarily the window actually used by the user.

ImageGlass would need at least the following changes:

  1. If ExplorerSortOrder returns no results, try invoking ExplorerSearchResults.
  2. Have the ability to view images based on a provided list, rather than reading the filenames from disk.
  3. When viewing images from a list, ignore commands or options which would conflict with the list, e.g. don't "scan within child folders".

All that said, I have no motivation or interest in creating ExplorerSearchResults. I am no longer actively participating in ImageGlass development.

ravewulf commented 2 years ago

So, if I'm understanding it correctly, this could work by adding GetItems to what's already there and using that instead of searching the directory/subdirectories of the opened image file IF (and only if) we know we have the correct Explorer window?

If we did know we had the correct window, then using GetItems would work for both search results (which already includes subdirectories) and regular folders (without subdirectories). The only difference would be for getting images in subdirectories when using a regular folder instead of a search.

L3nny666 commented 6 months ago

Displaying the explorer search results in correct order would be just great. for my specific workflow this would be gold.

preview 01 preview 02