Tabs deduplication command with current path protection and bothsidesism

This script adds a TabDedupe command to close duplicate tabs, but with a default option to protect (not close) the current tab so you could just add it to your open new tab/close current tab shortcuts/buttons and not have to manually invoke any dedupe commands, but also not worry that the newly opened tab will be deduplicatedly closed¹
It can also operate on both lister panes

Supported arguments:

  • right close dupes from ← right to left (default)
  • left close dupes from → left to right
  • noprotect close current tab if it's a dupe
  • dual close dupes in both left/up and right/down panes (uses the same left/right argument for each)

¹ you could also add a dedupe command before opening a new tab

TabDedupe dual
Go CURRENT NEWTAB

but this might have a strange side effect of opening a tab at the end of the tabbar instead of near the active tab when you tried to open a 3rd dupe tab

Cmd.TabDedupe.opusscriptinstall (4.6 KB)

4 Likes

Thanks for a great script !
Everything seems to be working for Tabdedupe Right and Tabdedupe Left.
But, I think Tab Dedupe Dual still has a small problem.

That said, I am not getting consistent results no matter what tab position is active on either pane or what pane has focus. I thought I could identify what it really is by changing the position of the active tabs.

Unfortunately, I have yet to be able to understand this action by simple trial and error despite many attempts to do so.

This script is a nice entry to a Tabs Context Menu.
Multiple identical tabs easily happen, at least for me.

What is the problem?

Tab Dedupe Dual is the same as Tab Dedupe Right Dual, all Dual does is runs the same closeDuplicateTabs function on the inactive tabset and with a different destination tab to protect

Hopefully you can get there! Though maybe you could check the script function logic and spot a mistake there?

I became confused with the action on tabs left of Tabdedupe Right and right of Tabdedupe Left.
I first noticed it when using Tabdedupe Dual.

I'm working on a more detailed and concise answer.
Thanks !