[BUG]: preview_single_handler_instance not working as expected

Found a bug in "Everything"? report it here
Post Reply
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

[BUG]: preview_single_handler_instance not working as expected

Post by DerekZiemba »

Not sure if Everythings fault or PowerToys fault. Everytime I preview a text file a new PowerToys.MonacoPreviewHandler is started + several msedgewebview2.exe processes.
I'm under the impression that "preview_single_handler_instance" is supposed to prevent this behavior. I have it to set to true but it doesn't seem to have an effect.

Unsure if there's anything you can do or if it's PowerToys's fault. I'm kinda leaning towards PowerToys as the occasional JIT exceptions don't inspire confidence. Figured I'll report here though.

I also have the Delphi Preview Handler installed, but PowerToys has overridden most of it. Wish I could instead override PowerToys when Delphi supports the file as it's a little nicer & more reliable, but I haven't found a way & PowerToys supports more types.
PreviewHandlers.gif
PreviewHandlers.gif (10.63 MiB) Viewed 5067 times
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by NotNull »

Moved to the Everything 1.5 Alpha forum.
Please post 1.5 Alpha related questions and reports there.


I think you mixed up "preview_single_handler_instance" and "preview_handlers" ?

To override the system (=Windows) preview setting for use in Everything:
  • Start the Registry Editor (regedit.exe)
  • Go to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers
    Will look something like the following:
    2024-05-08 21_42_59-Preview Handlers.png
    2024-05-08 21_42_59-Preview Handlers.png (126.59 KiB) Viewed 5061 times
  • MAke a note of the GUID of the Delphi Preview Handler
  • In Everything, go to Menu => Tools => Options => Advanced
  • In the Show settings containing field, search for handler
  • Select preview_handlers
  • If you want to preview txt,log,html and htm files using the Delphi preview handler, set it's value to:

    Code: Select all

    preview_handlers=[{"filter":"*.txt;*.log;*.html;*.htm",
    "handler":"{12345678-abcd-efg-123456789ABC}"}}]
    
    Where {123....ABC} is the GUID of the Delphi Preview Handler.

P.S IIRC: Delphi puts it's preview handler associations under HKLM, PowerToys under HKCU.
Uninstalling PowerToys leaves you with halfway corrupted registry entries: file extensions that were associated with it do no longer give a preview (at least that was the state of things 2 years ago).

There are ways to remove the PowerToys preview handlers (by editing the registry), which will re-activate the Delphi preview handler for selected file extensions, but I suspect that with the next update the PowerToys ones will be re-installed.
horst.epp
Posts: 1456
Joined: Fri Apr 04, 2014 3:24 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by horst.epp »

I have the Delphi preview handler installed and configured for many extensions with the registry.
Also, I have PowerToys installed but with disabled Monaco preview handler.
The Delphi previewer works fine in Everything.
______________________________________________________
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by DerekZiemba »

Not sure what you mean by mixing it up. I'm referring to this boolean setting:
viewtopic.php?t=12792#p54426
viewtopic.php?p=54421#preview_single_handler_instance
Screenshot 2024-05-08 183438.png
Screenshot 2024-05-08 183438.png (28.71 KiB) Viewed 5042 times
I originally set [c]/preview_single_handler_instance=1[/c] because of the Delphi issue in that linked thread some time ago. I only recently remembered the setting while troubleshooting lag & seeing near 1000 running processes. I was then further confused to find I had already set it true... as 1000 mostly preview processes stared me down from task manager.
Upon re-reading viewtopic.php?t=12792#p54426, I noticed u/void said "I'm adding a hack to Everything 1.5.0.1339a to only load one instance for this specific preview handler."
Does that mean the setting only applies to Delphi?

BTW, is anyone else having this problem with multiple previewer instances & them sticking around? Or is it just me?

-----------
It was never quite clear to me how to use the preview_handlers setting when reading viewtopic.php?t=9994#preview_handlers, but your post here has really cleared it up.
.... Several times now I've stumbled out of google & across a post of yours giving more details on a documented setting, and they've always been super helpful. Just want to throw out there, if you're ever considering linking from the documentation to posts like these, it'd be much appreciated.
-----------
Uninstalling PowerToys leaves you with halfway corrupted registry entries: file extensions that were associated with it do no longer give a preview (at least that was the state of things 2 years ago).
Yeah I've been there. The fix for me was uninstalling both, then reinstalling Delphi then PowerToys, enabling the PowerToys handlers, then installing Delphi again (hoping it would overwrite PowerToys where applicable, no such luck).
-----------
P.S IIRC: Delphi puts it's preview handler associations under HKLM, PowerToys under HKCU.
Ahh. PowerToys being in HKCU explains why I never found them. Didn't think to look there. I assumed PowerToys was doing something weird because none of my (ancient) preview handler editing tools show its handlers.
Explains why any change using the editor tool to use Delphi has no effect, as the tool apparently isn't aware of user level configuration.
Untitled.png
Untitled.png (358.5 KiB) Viewed 5042 times
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by NotNull »

DerekZiemba wrote: Thu May 09, 2024 12:19 am -----------
It was never quite clear to me how to use the preview_handlers setting when reading viewtopic.php?t=9994#preview_handlers, but your post here has really cleared it up.
.... Several times now I've stumbled out of google & across a post of yours giving more details on a documented setting, and they've always been super helpful. Just want to throw out there, if you're ever considering linking from the documentation to posts like these, it'd be much appreciated.
-----------
Thank you.
If you come across topics or posts that might be helpful for more people, please refer to them in the "Greatest Hits" thread.

( Otherwise, in a month time these post will probably be buried under hundreds of other posts; requiring archaeological excavations to unearth them ;) )
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by DerekZiemba »

Just noticed this today. If you resize the preview, a bunch more monaco preview handlers are created & some of them, not all (no idea why), even show up on the taskbar. It's not 1:1 to the process created and they don't show up everytime you resize.
taskbar-monaco.gif
taskbar-monaco.gif (1.78 MiB) Viewed 4664 times
Clicking them on the taskbar does nothing. Again, not sure if it's a voidtools problem or powertoys problem.
void
Developer
Posts: 17149
Joined: Fri Oct 16, 2009 11:31 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by void »

Thank you for the issue report DerekZiemba,

It took me a while to find the cause of the issue.

It's a issue with the Monaco preview handler and changing the preview position with SetRect before DoPreview.

I am working on a solution..
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by DerekZiemba »

Awesome!

Also have you been able to replicate the multiple monaco previewer instances starting & sticking around?
I was tempted to open an issue on https://github.com/microsoft/PowerToys/issues, but from FileExplorer the Monaco previewer exits.
previewers-in-explorer-exit.gif
previewers-in-explorer-exit.gif (1.3 MiB) Viewed 4503 times
Last edited by DerekZiemba on Tue May 21, 2024 8:03 am, edited 1 time in total.
void
Developer
Posts: 17149
Joined: Fri Oct 16, 2009 11:31 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by void »

Yes, the extra process is only created when Everything changes the preview position with SetRect before DoPreview.

With the coming fix, only one process is created and is closed when you hide the preview pane or exit Everything.
void
Developer
Posts: 17149
Joined: Fri Oct 16, 2009 11:31 pm

Re: [BUG]: preview_single_handler_instance not working as expected

Post by void »

Everything 1.5.0.1377a improves the preview pane.

Everything will now never change the preview position before calling DoPreview.

Only a single preview instance is now allowed by default.

This is now the same behavior as Everything 1.4.
Except, Everything 1.5 runs the preview handler in a separate thread.
Post Reply