Reopen multiple closed tabs via GUI or a command

This script fills one big gap in DOpus' tab management by adding an interface and commands to undo multiple closed tabs 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 :bookmark: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: jk▲ (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)

backup.TabUndo.opusscriptinstall (15.2 KB)

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

Undo ✗ Tab.dcf (1.6 KB)

A few things I'd like to add, but couldn't figure out how to due to DOpus or 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
  • clear history for all listers at once src
  • add help tooltips to buttons/checkboxes src
    • add help labels for single-key shortcuts jkl;
    • or small different colored overlapping labels for single key nav
  • way to just DEselect (⎈␠ toggles, DOpus can't get an item with input focus (which could be used to deselect) src)
  • formatting
    • disable window title and close buttons, window chrome resize border (could be done via AHK, but then will lead to "flashes of unstyled window")
    • manually sort user script vars src
    • make active listview's header bold 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
  • 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)
  • ? 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?)
  • your great idea! :slight_smile: