sienori / Tab-Session-Manager

WebExtensions for restoring and saving window / tab states
https://tab-session-manager.sienori.com/
Mozilla Public License 2.0
1.82k stars 183 forks source link

Consider using Tree Style Tab's full tree structure get/set APIs #1352

Open kini opened 2 weeks ago

kini commented 2 weeks ago

Is your feature request related to a problem? Please describe.

The Tree Style Tab support function of Tab Session Manager seems buggy. Often the tree structure of a window is not restored correctly. The parent-child relationships may be broken, or more commonly (for me) the tabs may become shuffled out of order within a subtree.

Perhaps this is caused by some race conditions when restoring tabs from a saved session, and that is why the advice for avoiding the problem is to put a large value for the setting "Delay when tree restoration (millisecond)", to let TST finish processing each tab before the next one is opened.

Describe the solution you'd like

TST has an API for other extensions to talk to. In the API, there are methods called get-tree-structure and set-tree-structure.

Maybe it is possible to use get-tree-structure when saving a session and set-tree-structure when restoring. Since set-tree-structure is a single operation, it may be more reliable and race-free than the current approach of letting TST process each newly reopened tab separately. TSM could first open all the tabs e.g. using TST's create API, and then call set-tree-structure only one time at the end.

Describe alternatives you've considered

The existing approach is in this file: https://github.com/sienori/Tab-Session-Manager/blob/master/src/background/open.js#L245-L250

Additional context This may help to address #846 and https://github.com/piroor/treestyletab/issues/2983 .

kirk56k commented 2 weeks ago

I'd like to second this request. I vastly prefer open source projects, but I've recently had to switch to a closed source alternative for saving my sessions due to the fact that TSM does not handle TST tabs well. Of course, I may be a bit of an extreme case, as I typically have between 200 and 500 tabs open at any one time. I rely heavily on the collapsing trees to keep my work organized. Being a researcher means I have a metric ton of search windows open at any one time for any given topic, each with dozens of results open within. And given that I'm working on several topics at once, having TST has absolutely revolutionized my ability to keep everything well-ordered. I would absolutely love to go back to using TSM, as I believe it is by far the superior option (baring the inability to handle TST tabs). Please keep up the awesome work. Thanks!

CliffRoberson commented 1 week ago

@kirk56k What closed source alternative do you use for saving your sessions that handles TST tabs well? I would like to try it and see.