This script fills one big gap in DOpus' tab management by adding an interface and commands to undo multiple closed tabs (at once via GUI or 1-by-1 in a sequence) by storing each closed tab in a persistent (across restarts) Lister variable
Undo✗TabVis command invokes an interface with the list of tabs which you can use to select multiple tabs to reopen
tabs are reopened at the position they were close in if said position can be found (not very precise in the presence of multiple tabs with the same path unless they were also present when the tab is closed), otherwise can be configured to be reopened at the end of the tab bar or to the right of the active tab
tabs retain their manual labels
a list for each pane in a dual-pane lister is shown unless history for inactive pane is configured to be hidden
by default tabs are reopened at the same pane they were closed in unless a force flag ‹Open/Open› is set
supports single-key shortcuts:
home row navigation without selection: j▼ k▲ (or m/, to jump by 5 (configurable) items)
home row navigation between panes: dleft fright pane
selection lselect ;toggle selection (let me know if you find a way to just just deselect) (see script config for the full list of keybinds that you can also rebind)
r/iConfirm / q/cCancel
o/p to force open in the left/right pane (sets ‹Open/Open› flag)
supports custom names of each column via user config
Undo✗Tab command opens a single tab from history, but unlike the default DOpus command, you can use it multiple times to reopen earlier closed tabs (with bg flag you can open the tab without activating it)
Undo✗TabClearHistory clears history with a confirmation is the list is above a configurable threshold (but only for the active Lister due to DOpus limitations)
(autoinstalled version works with DOpus 13.7, but if you manually copy&paste included script files to the main one it should work with earlier 13 versions)
An example button using a few of the commands (which you can also copy from this button to your "Folder Tabs" context menu:
opens the GUI listview on click
includes a tab undo (with and without switching to the reopened tab) and a button to clear history
A few things I'd like to add, but couldn't figure out how to due to DOpus or Win/other limitations. Let me know if you know of a great way to fix these!:
implement undo/redo selection:
(workaround via 1-sel-event granular undo even if it doesn't match user events that can include 2+) need to track track all events within a single user operation (e.g., select 5 items with one click+shift) src
(workaround via timer) need to differentiate between real and artificial selection src
prevent buffering so that releasing a held u key stops repeating undos immediately. (can't test for physical key down/up before executing?)?
focus is not reset on un/re-do as we don't get focus change events, so don't know what to restore to
make button shortcuts multilingual, use "physical keys" src
remove ellipsis... on truncation of columns in listview
set width/height minimum, but still make resizable? src
with shared height can't resize listviews on creation src
so bottom listview won't be resized with the dialog, will only move Y position as seen in the screenshot where resizing leads to the bottom listview moving on top of the top one instead of getting smaller
And a few things that might be nice to add:
? don't save dupes, but in a "smart" way:
if two tabs are opened and both are closed, store two
if one tab is opened closed and reopened, store it once at the last position
allow overriding more options via "cli args" so you could have a button to open just for the current lister's pane
add commands to toggle listviews top/bottom
optional vertical scrollbar for long lists
formatting
reformat dates instead of a single column so that times are vertically aligned even with different widths of Today and Yesterday
?(no need since due to persistent vars this should be rare) update height of the two listviews so that if 1st is bigger, but 2nd is empty, the second is moved/resized
reopen tabs closer to their neighbors on multiple tabs with the same path (need saving extra data on neighbors)
allow user config of button accelerators
add checkboxes (user configurable)
? search bar in case you get lost in your closed tabs
? make neighbor search smarter: (when original neighbors are missing, so IDs don't match) currently opens near the first matching path even if originally there were 2. Save same path count and open at the same "count" at target?
? show folder name as a separate column
? add a blacklist of paths not to store (regex)
? add a mark for user defined paths (some kind of favorites)
? add a max limit of shown undo tabs in the list (or history limit is fine?)
Don't know, I've tried removing my addins folder and installing the version from this forum, and it's working.
ConfigHelper is defined in the inc_cfg.js file, which you seem to have, you can see that it has function ConfigHelper(data) { //v2.0@24-04-04
Maybe do the usual dance: remove and reinstall
Worst case - you can always copy&paste these functions from the included scripts to the main one
Note that I tried it and got a first issue referencing line 399 when calling Undo✗TabVis
Erreur à la ligne 399, position 7 (ligne brute 403)
Argument ou appel de procédure incorrect (0x800a0005)
Nothing weird on line 399 (maybe a call out of range ???), but I found a missing colon on line 390 : var by = sC['▼▲⋅X']
After adding it, I now have another error :
Erreur à la ligne 273, position 3 (ligne brute 277)
Argument ou appel de procédure incorrect (0x800a0005)
And this line is Dlg.Create(); // create detached
I suspected a character encoding issue (as I already had that kind of issue when using certain unicode characters in the dialog controls) but the file shows UTF8-BOM encoding as described at the start of the script ... I didn't go further.
semicolons are optional, so should be fine
You have strange line numbers, var by = sC['▼▲⋅X'] is on line 410 in the file (raw) and -4 lines in the editor (it exlcudes import lines), so still not 390. Is the script the latest version?
So I don't know what 399 refers to
Otherwise the errors seem the same
Maybe it's a version issue and I'm using some function from a later Opus version? You could test with the latest 13.8
Or could try replacing all unicode chars with something else and see if it helps?
I had the release 0.3@24-04 installed, but changed to 0.4@24-07.
Pretty strange as I thought downloaded it this morning.
I still have the same issue reported with new install :
Erreur à la ligne 399, position 7 (ligne brute 403)
Argument ou appel de procédure incorrect (0x800a0005)
So I added a few outputs in the file, and it seems to fail during the enumerations of hk and its members. Code modified is (starting on line 400) :
var hk = getHotkey(0);
DOpus.Output("Test line 401");
for ( var e = new Enumerator(hk) ; !e.atEnd(); e.moveNext()) {
DOpus.Output("Test line 403");
DOpus.Output("e.item():" + e.item());
for (var n = new Enumerator(hk(e.item())); !n.atEnd(); n.moveNext()) {
DOpus.Output("Test line 406");
DOpus.Output("n.item():" + n.item());
Dlg.AddHotkey(n.item(),n.item());}}
DOpus.Output("Test line 409");
And output goes like this :
23/07/2024 14:10 backup.TabUndo: Test line 401
23/07/2024 14:10 backup.TabUndo: Test line 403
23/07/2024 14:10 backup.TabUndo: e.item():Nav▲
23/07/2024 14:10 backup.TabUndo: Test line 406
23/07/2024 14:10 backup.TabUndo: n.item():k
23/07/2024 14:10 backup.TabUndo: Test line 403
23/07/2024 14:10 backup.TabUndo: e.item():Nav▲5
23/07/2024 14:10 backup.TabUndo: Test line 406
23/07/2024 14:10 backup.TabUndo: n.item():,
23/07/2024 14:10 backup.TabUndo: Test line 403
23/07/2024 14:10 backup.TabUndo: e.item():Nav▲5▋
23/07/2024 14:10 backup.TabUndo: Test line 406
23/07/2024 14:10 backup.TabUndo: n.item():Shift-,
23/07/2024 14:10 backup.TabUndo: Test line 403
23/07/2024 14:10 backup.TabUndo: e.item():Nav▲▋
23/07/2024 14:10 backup.TabUndo: Test line 406
23/07/2024 14:10 backup.TabUndo: n.item():Shift-k
23/07/2024 14:10 backup.TabUndo: Erreur à la ligne 404, position 7 (ligne brute 408)
23/07/2024 14:10 backup.TabUndo: Argument ou appel de procédure incorrect (0x800a0005)
The line reported in error (raw 408) is : Dlg.AddHotkey(n.item(),n.item());
which is coherent with outputs, since last trace is the n.item() and we do not go back and find Test line 403 for the next Enumerator e loop.
Ooops. Sorry, it was too small on my laptop screen for me to really see the symbols.
FYI, I just discovered two days ago that you can now actually display icons in the buttons, either by referencing their path, or, in case they are part of the "standard" internal icon sets, by referencing their "#name" (Control [Directory Opus Manual]).
If you add this property and also provide a title to your button + set the very last property in the button UI editor ("etiquette" in french) to yes, you get both the icon and the title displayed on your button.
I also used unicode to add meaning to my buttons, but I think I'm gonna use this more now.
I didn't catch when this was added, but I don't have this on my 13.1 install (but it's on 13.7.8).
Only drawback I see : I think this does not get shared in the ".opusinstall" ... but I did not test.
Here is a three button button that makes it very easy - with a single click - to undo closed tabs. I suggest putting it in the location bar since it will undo for each lister in a dual lister.
I think it might be due to includes only introduced in version 13.7, so will bump the min version to that (but you can still copy&paste those included scripts to the main one)
Nice work!
I would suggest using names for the include files that are clearer/more distinct. Because eg cfg/gui/std are ambiguous and with the amout of different named files in this directory it can become messy quite fast. I know that there is no naming convetion but you could think about adding the name of your main script to those include files.
Also you dont have to put your resources into an include file, you can simply attach it to your main script
Unfortunately I use those files in other scripts as well, so wouldn't want to keep the dupes. But this can be export zipped as a DOpus "package" instead to have no conflict with user files scripts and be a single file (that one also can have custom images)
The main dialog resources are already attached to the main script, but if you mean the ones in the inc_gui, think that's also because it's shared with some other script
Yea I've been using 13.7+ (I usually have the latest beta). I was able to get it to work by copying the code from the inc_cfg file into the main file. Still not sure what the problem was.
This is interesting. Would be good for Dopus to save recents as 'Lister Sessions'.
A comparable thing is Workana Tab Manager for the Chrome browser.
I have the recent tabs enabled in my folder tree. So I can open that branch, see where I left off, and starting from there, middle mouse button press down the list like a MF until all my tabs are restored.
We have the tab groups that we can save statically, which is something.
Maybe just having the recent tabs in lister groups would be good enough for this. We could click on the group to 'Open All', like a Chrome tab group.