Event: CloseTabSiblings (autoclose equal tabs in tab-row)

Thank you for this very nice script!
I've noticed a bugs: when I restart lister, it would close ALL tabs but currently active one (including non-duplicate tabs) in case it finds any duplicates instead of closing just the duplicates

Also, would it be possible to add the following two modifications.

  • Add a command that would ignore all "temporarily protected" tabs? E.g. when I open a new tab with a modifier (Ctrl+T most of the time) the path gets "protected" and even if I click my toolbar button with CloseTabSiblings command these duplicate tabs don't get closed

  • Separate tab change and folder change events so I can only close duplicates whenever a tab is opened/closed. However, this might still not achieve what I'd like, see below

What I basically need is
a) an ability to open a new tab with Ctrl+T without it being closed right away as a duplicate
b) NOT having this new tab/path protected in case I open another tab (or close another tab for that matter)
c) have command trigger on any tab changes (new/close), but on folder changes (i.e. during navigation). If I happen to temporary navigate to the same path as is open in another tab, I don't want anything to close.

It seems to me the current option set doesn't allow this, but maybe I just don't know how to configure it properly.

  1. So you'd like some kind of "FORCE" option, I think that can be done.

a) You can set DO to always open empty tabs (I find that the fastest and most convenient way, maybe you like it as well).
It can be done in the preferences. And regarding the CTRL+T shortcut: Change the command to "Go NEWTAB" (remove CURRENT argument). With tabs always opening empty, no tab will get closed right away.
You can also add the "NOSCRIPT" argument to your shortcut (leave the CURRENT in there if you like), it prevents DO from triggering any script events, so no tabs will close.

b) Sorry, I don't understand. Is this related to point a) as well?

c) Seems reasonable.

I got an idea — I think it should be "Force except for current path". This way I can just bind it to a new tab open and the only duplicate tabs left after this operation would be the last two.

Unfortunately, that's rather inconvenient as I'd lose my current path — and the main reason I'd open a new tab instead of my favorite folder (either via Winkey+# shortcuts or by just alt-clicking on the favorite list in the tree view) is precisely because I need to navigate around current path, i.e. when a few "go up/select another folder" commands are faster than starting from a favorite folder position.

Thank you for the tip, at the moment it seems even worse than having Ctrl protect the path as it means none of the other duplicate tabs will close. But maybe if I disable qualifiers and add your command to run after closing a tab, that could be a temporary solution

Yes, it's an additional condition to a) that would make the script behave like I would ideally like it to behave.
Let me clarify this point. If I Ctrl-T a new tab, this path will get "protected" (assuming qualifiers are on), which is nice as it prevents this new duplicate tab TabADup from being closed automatically.
Now suppose I just leave these two duplicate tabs TabA and TabADup hanging there and switch to a different 3rd tab and then invoke CloseTabSiblings. I would like the "path protection" to fade by then, so that any subsequent use of the script would close TabADup. However, this doesn't happen because the path stays protected until the script is restarted, thus polluting my tab space.
Moreover, if I happen to navigate to this path in the 3rd tab, then it wouldn't close duplicates either since this path is protected.

c) there is also a typo, I meant "but NOT on folder changes"

Hm, I just now realized that your script closes tabs duplicating current path only, not all duplicates :frowning:
That's quite a downer and is even worse than lack of the other features I mentioned earlier. Is there a chance to please extend duplicate check to all tabs, not just current tab? Then I'd be able to get to 90% perfection with Autohotkey (for closing duplicates on opening a new favorite folder with a shortcut) and adding CloseTabSiblings to close tab (ctrl-W) shortcut — all in with qualifiers off (to avoid protecting any paths) and folder/tab change scan off (to avoid auto-closing new tabs "Go CURRENT NEWTAB").

I have following suggestion: If tabs are in a linked state, make them an exception, so that double tabs stay untouched. I have following usecase in mind.

K:\Pictures <=> N:\Pictures is linked, but i also want to use K:\ Pictures <=> L:\Secondlocation, which means, that one lister side would require an exception double location.

Thanks Abr, will see what I can do for the next upload.
I fixed some other parts on it already, since CloseTabSiblings was doing some things DO did not like the way it did them.
DO would eat all memory available and bring my machine to full stop, whenever a tab auto-closed, wonder why nobody else noticed. But now you know, if you change folders and your system eventually stops working because of high memory usage, it is this script addin! Well, it might be. o)

Thanks tbone. I had no issues, regarding the memory, so far. So maybe other co-factors might be involved. Looking forward to the new version, but no hurry, of course.

Sounds super but I'm confused about how this works.

Am I supposed to be able to have two TEST tabs open?

Didn't touch the settings.

Yes, in specific cases this is expected. CloseTabSibling is primarily checking whenever you open tabs or navigate folders if there are existing Tabs to close. I think about expanding this to also match other peoples expectations. o)

I think I must be misunderstanding something fundamental. When I had the TEST tab open, then navigated to TEST in another tab, I thought that was exactly the use case described at the top, and expected the first tab to close. What am I misunderstanding?

Could be the tab start index kicking in. You can set a start index to always protect the first x tabs from closing.

Hey tbone, thank you for your troubleshooting thoughts. Never heard of a tab start index, sounds cool but I don't think I have one. I can close all the tabs except one. Tried disabling all other scripts in case of a conflict, still no luck. Don't worry about it, I just wanted to have a play with it. :slight_smile: Have a great weekend.

I think tbone meant the script has one you can adjust :slight_smile:

@tbone Hey man, sorry, just looked at the script code for fun, and realized that the start index is a tbone thing, not a DO thing. You were right, I set it to zero in the config and now it seems to work! Thank you!!! :thumbsup:

EDIT just saw wires got crossed and Jon posted the same info.

@Jon sorry, crossed wires, my previous msg was for tbone. Yes you are right, came to the same conclusion. Thanks!

I'm a bit lost as of how this differs from using the Go NEWTAB=findexisting command?

NEWTAB=findexisting will switch to an existing tab if there already is one for the folder you're opening. But it won't close any other tabs if several of them all point to the same folder (which can still happen if you e.g. go to a child folder and then go up a level in multiple tabs).

1 Like

@tbone Strangely, I have an issue where if I press + button for New Tab, the new tab gets auto-closed. I reported about it in another thread, but later found out that turning off this script fixed the issue. Is this just me?

Had a quick test, it seems to work for me, kind of.
But I noticed the DO script settings have problems, toggling values does not seem to be reflected in the script config. Not sure if this is related to your problem, I need to see if it's the script itself or some DO change. The script is 6 years old, quite possible there was a change which screws things up now. I did not use the addin, though I still deal with too many tabs showing the same folder..

So I guess I should investigate and maybe start using it again. o)

1 Like

Only do it if you need this yourself, tbone. However, if you do look into it, let me know if I can be of any help.