ShowIf test for multiple listers?

Is there a simple way of testing for multiple open listers, similar to this test for multiple selected files?

@hideif:=(selfiles > 1)

Using Evaluator, and I am thinking an Evaluator column,
it is easy enough to integer add to a global variable $glob:variable_name by testing if
if (index==1).

But I can't think of an easy way to decrement the variable as listers close.
Anyone ???

If this script is enabled, you can use its variable like this:

@hideif:=$glob:listerCount>1

My use case is a button that collapses all listers into one. Here's my code:

// Collapse multiple listers into one
@hideif:=$glob:listerCount<2
function OnClick(clickData)
{
	if (DOpus.listers.count == 1) return;
	var cmd = clickData.func.command;
	cmd.deselect = false;
	cmd.addline("Go /default NEW=nodual,nometapane,notree,noutilitypanel,noviewpane");
	cmd.addline("[");
	cmd.addline("Close  ALLLISTERS=collapse,unique");
	cmd.addline("]");
	cmd.run();
}

And here's a button running your code:

@hideif:=$glob:listerCount<2
CycleListers

Put both on a toolbar and see what happens when you add and then close a second lister or collapse all listers.

Good to know since I already use your script. :melting_face:

To clarify, what I see is that neither button is hidden until I navigate away from the resultant single lister.

Yes, the variable does not recognize Close ALLLISTERS=collapse,unique .
I had noted that in the original June 2024 thread.

I'm happy that we have this.

Edit Note:
Yes, I forgot about it.

In the next beta SysInfo("ListerCount") can be used in the evaluator to get the current number of Listers.

4 Likes