Disable Viewer pane when supported-file not selected

I'm getting very frustrated when I view an image/video in the viewer pane but then go to another task (say just navigating through folders) where the old media is irrelevant but is still being played/shown in the pane. I'm trying to find a way to either disable the viewer pane (or make it white/blank) when a selected file/folder is unsupported so that the currently selected file is always what is shown in the pane. A script/way to white out the viewer pane when switching folders would be close to what I'm aiming for but I can't find a property to set what is shown in the viewer pane. Any advice would be appreciated.

1 Like

An option for that might make sense, I agree.

As a very quick solution, you could try dropping this script on the Preferences / Toolbars / Scripts list:

A better version of the script is in my July 2022 reply, below.

Click here for the OLD script

That will close and re-open the viewer pane (if it is already open) each time you change folders.

The downside is that it causes a bit of flicker when navigating, since the viewer closes and then re-opens.

function OnInit(initData) {
	initData.name = "ClearViewer";
	initData.version = "1.0";
	initData.url = "https://resource.dopus.com/t/disable-viewer-pane-when-supported-file-not-selected/30685";
	initData.desc = "Clear the viewer pane when changing folders";
	initData.default_enable = true;
	initData.min_version = "12.10";
}

function OnBeforeFolderChange(data) {
	if (!data.initial && data.action != "refresh") {
		var vp = data.tab.lister.viewpane;
		if (vp != 0) {
			var vertOrHoriz = (vp==1) ? "Vert" : "Horiz";
			var cmd = DOpus.Create.Command();
			cmd.SetSourceTab(data.tab);
			cmd.AddLine("Set VIEWPANE=Off");
			cmd.AddLine("Set VIEWPANE=On," + vertOrHoriz);
			cmd.Run();
		}
	}
}

Like you said, not the perfect solution, but this works great for me; thanks!
If I squint I think I can make flicker but it's so subtle that it doesn't bother me one bit.

1 Like

Hi,

I am new to opus and it is so fantastic, that I don't believe that something so simple is missing. So I decided to look everywhere.

I searched docs and later the word "preview pane" at this form. I opened almost 20 articles to try to find solution when selecting something else that is not the file being previewed, to clear the preview pane.

I instatlled the js file and is working as expected. When selecting another folder, the preview is being "cleared". that's ok.

But sometimes I click on a file just to take a look and I don't want to keep it open in the preview because it gets in the way of my concentration.

So why not clicking on a empty space at lister is not deselecting file that is being previewed, clearing the preview pane?

Maybe a checkbox option at preferences could be added to the settings so we could quickly clear the preview. It doesn't seem very logical to keep an open image for example at preview, when I'm already thinking about doing other things.

This forced me to keep preview pane always closed, and I open only when want to see some previews, but best option will be left preview opened and when clicking on empty space at lister clear it's contents.

Thank you,
Sergio

Why not close the preview pane when it's no longer needed or distracting? It's quick to re-open it again when you need it, and doesn't do anything useful when nothing is loaded into it.

I am having the exact same problem as capetech and and sergoroit.
What is needed is an option that the Preview Pane only shows a picture when a picture is selected (white text/dark blue background). This will fix all issues:

  • No flickering/constant reloading of the Pane (Often I need to quickly go through long lists of media files, and they need to load fast in the viewer). It's just not good if the Viewer has to load/unload for every single one of hundreds of files.
  • If the user desires that nothing be shown, but the user does want to keep the Viewer Pane (because it is supposed to be active 99% of the time, then all that needs to be done is deselect files (which is easier when full row selection is disabled, though). Alternatively/in addition there could be a small button at the top of the viewer pane that will clear the screen.
  • Most importantly, when the user is navigating in unrelated places, thanks to that option no random picture will continue to be shown in the viewer pane which, frankly, looks very unprofessional.
  • Closing the Viewer in order to get rid of some picture defeats the point because a) it would have to done often (and manually, and will be forgotten, and is disruptive of work) and b) the user does not intend to close the viewer as it will be needed again soon.

I think you can already have a button to clear the viewer pane but why would you want to do that (and have to keep doing it every time you selected something in a place you don’t want to view things) rather than click the existing button to close the viewer pane?

I must be missing something as closing the viewer pane seems just as easy, and has the added benefit of giving you lots of extra screen space instead of wasting it on a panel that would be empty (or showing something you don’t want to view). Re-opening it is also just a single click.

Hello,
I'll try to explain:

I think the point here is different usage patterns.
If you make heavy use of the Preview Pane (like myself, and probably the other users in this thread), then the Preview Pane being visible is the default, standard state of DOpus. It not being visible is the rare expection. The exception happens for me only when I need to view the location of files in an additional column which happens only in Flat View (which I rarely use) and Find Results. And even in those cases, I need to hide the Viewer Pane only in around half of situations, if at all.
The Viewer Pane is thus basically not just visible all the time, it is also in constant use. I am looking there as often as I am looking at the file list, basically. Thus there is hardly ever a reason to hide it, because it would have to be re-activate just moments after.

There were two cases:
Case 1:

The user wants to get rid of the preview image because it is distracting. in order to get rid of the distraction, the user would have to start to look for some other file in the folder that e.g. won't show as an image etc. Alternatively, the user could also close the Viewer (and reopen it as soon as he continues works that requires use of the Viewer).
Clearly, clearing the Viewer is better than closing it and having to re-open it.
The script that Leo has provided probably already contains most of the code that would be needed to make a button that will simply clear the viewer upon button press (not upon folder change).
Such a button would be quite useful, and certainly it need not be integrated into the Viewer, just a normal toolbar button would suffice.
In general, case 1 is a minor issue, but can come in handy once in a while, or for certain users in certain scenarios.
Btw I tried to see what will happen when I toggle Viewer Pane off and on again, and what happened was that the Pane showed the same file again, immediately (did not stay blank), and even when it was not selected prior to re-activating the Viewer Pane.
Alternatively, not displaying anything as soon as there is no selection would also make things better in many cases.

Case 2:
Whilst the skript provided does solve the issue of some un-related file being displayed in the viewer pane, the Viewer Pane closing and opening /flickering with every folder change seems a bit dubious for me...... I am not keen on installing this.
In Windows 11 Explorer, all works as expected:
When I select a folder within the viewer pane (i.e. one of the folders that are diplayed alongside the files), the viewer pane will change and display nothing (it could of course ideally display a preview of the folder like in the tooltips when mouse-hovering over a folder). But it will no longer show some random previously selected file, as DOpus does.
And when the folder selected in the tree view is changed, then Viewer Pane will also be cleared, saying that you are supposed to select sth in order to have it displayed.
And when you click into the white area of the File View, removing the selection, then too the Viewer Pane will no longer display anything (which obliterates the need for a clear viewer button).
Thus Windows 11 Explorer does all of these three things the right way / the way the other users and myself were suggesting.

I hope this was explained well enough, I'm no native speaker and sound a bit clumsy (but not just for that reason haha :slight_smile: )

Thanks for reading.

(Also, the heading of this thread is not quite identical to what I was thinking, I was thinking of the Viewer Pane being visible ALL the time irrespective of whether a file is displayed or not, and only hidden when it gets in the way of the file location column, or e.g. in thumbnails display mode where a lot of space might be needed. The point being that the Viewer pane being shown/not shown all the time depending on whether a selected file is supported or not would be a huge distraction.)

Sir, the ClearView script is doing the job, but makes Opus quite slow, and turns off the transitions as well. Is there any other workaround for clearing the Viewer pane without having to forcefully select another file for the same?

Here's an improved version of the script which just clears the viewer pane on folder change, rather than turning it off and then back on. (This probably wasn't possible back when the original script was written.)

Drop it on Preferences / Toolbars / Scripts as before.

ClearViewer.js.txt (613 Bytes) v2.0

Script code for reference:

function OnInit(initData) {
	initData.name = "ClearViewer";
	initData.version = "2.0";
	initData.url = "https://resource.dopus.com/t/disable-viewer-pane-when-supported-file-not-selected/30685";
	initData.desc = "Clear the viewer pane when changing folders";
	initData.default_enable = true;
	initData.min_version = "12.28";
}

function OnBeforeFolderChange(data) {
	if (!data.initial && data.action != "refresh") {
		var vp = data.tab.lister.viewpane;
		if (vp != 0) {
			var cmd = DOpus.Create.Command();
			cmd.SetSourceTab(data.tab);
			cmd.RunCommand("Show VIEWPANECMD=clear");
		}
	}
}
2 Likes

Sir, is there any way to bypass the 'Lock Viewer' function conflicting with 'clearing' function within this script?
Let's say I've a text file for reading instructions in the viewer pane, and I have to switch to another tab, but the locking function won't work unless, within the same tab and/or turning this script off. Rather, I desperately need this script's functionality too.

The script could probably check if the viewer pane is locked and avoid clearing it if that's the case.

Please link your account if you want me to look into that and write the script for you.