Tabs don't behave the way I expect them to behave so I'm writing a script to correct this. There are a few issues I've run into but I am working on resolving them. I am also looking into a way to add configuration to the scripts without requiring users to edit the files directly.
First script: Prevent locked tab from being closed ( unless you use the menu / right click > close to close it - There is no way to detect if the menu was used, or if middle click was used so I am adding a modifier + middle-click / menu option [ ie if modifiers { qualifiers } not "none" then allow, otherwise prevent... ] )
Acecool - Prevent Locked Tabs from being Closed without Modifier.js ( Will either be 1 file or a collection, although the process of renaming a zip file is stupid, of files with configuration options )
//
// Acecool™ - Prevent Locked Tabs From Being Closed Without Confirmation
// Josh 'Acecool™' Moser - 1985-Indefinitely - Released under the Acecool™ Company License ( ACL )
//
// This is a script for Directory Opus.
// See http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
//
//
// Called by Directory Opus to initialize the script
//
function OnInit( _data )
{
_data.name = "Acecool™ - Prevent Locked Tabs From Being Closed Without Confirmation";
_data.version = "1.0";
_data.copyright = "Josh 'Acecool™' Moser - 1985-Indefinitely - Released under the Acecool™ Company License ( ACL )";
// _data.url = "https://resource.dopus.com/viewforum.php?f=35";
_data.desc = "Prevents you from being closed without confirming it first...";
_data.default_enable = true;
_data.min_version = "12.0";
}
//
// Prevent closing tabs when the tab is locked unless holding Ctrl / Alt / Shift ??....
// Called when a tab is closed - closeTabData - https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Scripting/CloseTabData.htm
//
function OnCloseTab( _data )
{
// Tab Object
var _tab = _data.tab;
// Lock State of Tab Object - Can be: "off", "on", "changes", "reuse"
var _state = _tab.lock;
// Is the tab locked ( any state )
var _locked = ( _state != "off" ) ? true : false;
// Key Modifiers held while trying to close tab... - Can be: "none", "shift", "ctrl", "alt", "shift,ctrl", "shift,alt", "shift,ctrl,alt", "ctrl,alt"
var _mods = _data.qualifiers;
var _modded = ( _mods != "none" ) ? true : false;
// Prevent closing the tab if the tab is locked and no mods are pressed...
if ( _locked && !_modded )
return true;
}
Planned: If you have a tab / path opened ( I may require it to be locked, or not ; depending on settings but by default it will do this regardless of lock status ) and you switch another tab to said path, then instead of that tab switching paths it remains the same and focuses the tab that is already opened.. Likewise, when going back ( and I hope we can alter the history system ) it will re-focus the other tab instead of switching the path since the path is already open...
On top of this, I may add config because multiple listers can be opened... that this switching will only occur for the current lister with an option to allow it to switch to other listers or dual panes... By default, as I only use 1 lister, it will allow hopping...