'Duplicate tab' next to active tab, but 'New Tab' at end?

Hi,

  • How to set the 'Duplicate Tab' to display the new tab NEXT to the active tab BUT(!) - in parallel - that when opening a new tab with the '+' switch, the (really) NEW (default) tab is displayed AT the (right) end of all opened tabs (EXACTLY WHERE the '+' sign is shown)?

  • Additional question: Where/how can I set that double-clicking on an active tab will duplicate that tab (without having to awkwardly right-click to select it)?

[in preferences -> options you can't set both exactly like this]

Many thanks for help.

  • Turn off Preferences / Folder Tabs / Options / Open new tabs next to the active tab to make the New Tab (+ button) open new tabs at the end.

  • Make a button or hotkey (or edit the existing Folder > Folder Tabs > Open New Tab (Ctrl+T) menu/hotkey) to run this command, which will duplicate the current tab next to the current tab:

    Go CURRENT NEWTAB TABPOS=+1 
    

I don't think there is a way to change what double-clicking a tab does, other than the Preferences option to make it close tabs.

Scripts can do things when you hold Ctrl, Shift or Alt and single-click a tab, if that's any use.

Thank you very much, that works.
But the command/the item called "Duplicate tab" in the menu that one opens when clicking on a tab with the right mouse button can NOT be modified with Go CURRENT NEWTAB TABPOS=+1 ?

That menu can't be edited currently. Maybe in the future, it'd definitely be useful, but isn't trivial to do either.

O.k. Leo, thanks anyway.
But one last question: You wrote: Scripts can do things when you hold Ctrl, Shift or Alt and single-click a tab, if that's any use. - That would be perfect (and very, very fast in everyday work), if you only would have to hold down for example the StRG-key and then left-click on the tab so that this tab will duplicate. The only problem is I'm not a developer and I don't know much about scripting. Do you happen to have a similar script from which I can deduce how to write such a script? Thx. a lot.

(Edit: v1.1 - Fixed issue with unwanted tab linking in dual-display windows.)

Download this and drop it on to Preferences / Toolbars / Scripts:

Ctrl-click to duplicate tab.js.txt (701 Bytes)

(Full instructions on installing script add-ins here.)

Code for reference:

function OnInit(initData)
{
	initData.name = "Ctrl-click to duplicate tab";
	initData.version = "1.1";
	initData.copyright = "(c) 2021 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/duplicate-tab-next-to-active-tab-but-new-tab-at-end/39077/5";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "12.24";
}

function OnTabClick(tabClickData)
{
	if (tabClickData.qualifiers != "ctrl")
		return false; // Allow standard click action.

	var cmd = DOpus.Create.Command();
	cmd.SetSourceTab(tabClickData.tab);
	
	cmd.RunCommand("Go CURRENT NEWTAB TABPOS=+1");
	return true; // Block standard ctrl+click so tabs don't get linked as well.
}
2 Likes

Leo, many thanks - you are fantastic!

Running this useful script with a dual pane lister creates a new adjacent tab in the source pane, as expected, but as a side effect the new tab is immediately linked with the current tab in the other pane. If I execute the underlying Go CURRENT NEWTAB TABPOS=+1 command on its own as an instant command it works as expected without the side effect.

Hi aussieboykie,
just for my understanding: What do you mean by "linked" exactly ("the new tab is immediately linked with the current tab in the other pane") - ... and with what effects or what effects are different with the user command you wrote?? Thx.

Before duplicating tab on left...

After duplicating with the script, the duplicated tab is linked with the active tab on right...

Picking a different qualifier in the add-in should solve this:

https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Tabs.htm

I've updated the script to fix that. Have edited my original post to keep everything in one place.