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

(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