Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort Tabs by URL, Title, CreationTime #643

Closed
rafo opened this issue May 31, 2022 · 21 comments
Closed

Sort Tabs by URL, Title, CreationTime #643

rafo opened this issue May 31, 2022 · 21 comments

Comments

@rafo
Copy link

rafo commented May 31, 2022

Description

First of all: Thank you for this wonderful extension! Firefox should implant this (instead of "Show all Tabs" and "Container") in the core functionality and pay you a fair share.

We could already sort bookmarks as shown in the screenshot. It would be wonderful if Sidebery offer the same for tabs (URL, Title, Creation Time).

A nice side effect would be that one can now easily mark the sorted tabs and group/move/mute/unload them.

I know there is always the risk of "feature bloat" and there are other plugins which can do the sorting, but I imagine that you maybe already have a lot of the functionality implemented...

Cheers,
Rafael

Bildschirmfoto 2022-05-31 um 11 25 16

@tommcc
Copy link

tommcc commented Jun 1, 2022

I have found that tab sorting add-ons (at least two popular ones I tried) mess up Sidebery panels, sometimes moving all of them to one panel, or introducing errors in the tree hierarchy. It seems like only Sidebery can successfully implement this. @rafo Do you use a sort add-on currently?

@rafo
Copy link
Author

rafo commented Jun 2, 2022

@rafo Do you use a sort add-on currently?

This is exactly the reason why I don't use a plugin of this kind.

@brokedarius
Copy link

#653

I opened a similar issue unknowingly please merge if possible.

@pmaciel
Copy link

pmaciel commented Apr 27, 2023

Very interested in this too! A extension I was using to sort (I forgot which.. sorry) messed up Sideberry an dso, I removed said extension hoping this feature will show up eventually :-D

@the-a-man-006
Copy link

Sort tabs by last accessed too. TabSlider (sorts tabs by MRU) doesn't interact well with Sidebery. Quick Tabs Ported doesn't present the MRU list as an always visible side panel and has to be clicked instead. Plus there's the risk that multiple views of the same thing (tabs) might be disorienting.

An MRU implementation in Sidebery:
When user switches to any tab, drag the tab and its whole subtree up at the top. Children of the same parent stay sorted in the MRU order; the upper the more recently used one. A parent's own ranking/last-accessed-time is that of its most recently accessed child, or itself (whichever is more recent). Thus, clicking a child tab of a very old parent should drag the whole parent up at the top too. Life would be bliss.

@piousdeer
Copy link

Related:

After a long time of using Sidebery, I decided I want my tabs to be placed in reverse chronological order (new tabs first). So I set "place new tab..." options to "panel start" and "first child". However, I was left with hundreds of previously opened tabs that were positioned chronologically. Manually drag-and-dropping each one to the top obviously wasn't feasible, so I wrote this script:

(async function () {
  const { Sidebar, Tabs } = getSideberyState()
  const panelInfo = Sidebar.getActivePanelInfo()
  const tabsToMove = Tabs.getTabs(panelInfo.tabs.map(tab => tab.id))

  for (const tab of tabsToMove) {
    const branch = Tabs.getBranch(tab)
    const info = Tabs.getTabsInfo(branch.map(tab => tab.id))
    const { windowId, pinned, parentId } = tab
    const src = {
      panelId: panelInfo.id,
      windowId,
      pinned,
    }
    const dest = {
      containerId: tab.cookieStoreId,
      panelId: panelInfo.id,
      index:
        parentId !== -1
          ? Tabs.byId[parentId].index + 1
          : panelInfo.startTabIndex,
      parentId,
    }
    await Tabs.move(info, src, dest)
  }
})()

It inverts the tab order on the currently active panel. Last tab becomes first, last child in a tab tree becomes first. I've only tested it on v5.0.0b31, other versions aren't guaranteed to work. If you want to run it, create a snapshot first!!! Then, go to about:debugging#/runtime/this-firefox, click Inspect next to Sidebery, in the iframe menu next to the 3 dots menu in the upper right corner select /sidebar/sidebar.html, switch to console, switch to the target panel in Sidebery, paste my script into the console, run it and wait for it to finish.

@alexander-paterson
Copy link

Is this being considered for an update to the extension?

@rafo
Copy link
Author

rafo commented Jul 19, 2023

Is this being considered for an update to the extension?

¯\_(ツ)_/¯

@JohnVKRDam
Copy link

Just want to add to this request, my sincere wish for sorting options to be implemented.

[p.s. I recently and erroneously posted my request in the Ideas section: Ideas #1197]

I really, really do hope these sorting options will, at some point, be implemented. You have no idea how long and how much I have longed for an extension to be able to do this. Even just a "simple" sort on Tab Name/Description, without messing up the (any) Tab Manager's own tab order...
I have thousands upon thousands of (highly valued) tabs, not only online of course, but also exported in Groups (my main tab manager was Tree Tabs (TT) up until now; a Group in TT is what Sidebery calls a Panel and you can export these individually).

Being able to sort tabs would be HUGELY helpful.

mbnuqw added a commit that referenced this issue Mar 3, 2024
- tab context menu options
- tab panel context menu options
- keybindings

(#170, #643)
@mbnuqw
Copy link
Owner

mbnuqw commented Mar 3, 2024

Alright, so I've implemented more of less functional tabs sorting. Two modes are available:

Normal (shallow) mode

  • Sort by title (A-z)
  • Sort by title (z-A)
  • Sort by URL (A-z)
  • Sort by URL (z-A)
  • Sort by access time (Old-Recent)
    Note: access time is used instead of creation time because Firefox doesn't provide creation time.
  • Sort by access time (Recent-Old)

How it works: If there is only one selected tab, it will try to sort all direct children of the parent (siblings, in other words). If there are multiple selected tabs, it will try to sort exactly what was selected. It also excludes folded child tabs.

Tree mode

  • Sort tree by title (A-z)
  • Sort tree by title (z-A)
  • Sort tree by URL (A-z)
  • Sort tree by URL (z-A)
  • Sort tree by access time (Old-Recent)
  • Sort tree by access time (Recent-Old)

How it works: In contrast, it will include all descendants of selected tabs, and it won't implicitly sort sibling tabs.

How to use: There are context menu options for tab and tab panel (check Menu Editor) and keybindings.

You will be able to test it from the v5.1.1.9 nightly build, but be careful as bugs are very likely for this feature now.

And of course, feedback/suggestions are welcome.

@JohnVKRDam
Copy link

That is AWESOME!! Thank you so much!

One quick question:
Does sorting on TITLE also consider the custom (edited/renamed) titles? Or only the original title of the tabs?
I do hope it's the former.

@mbnuqw
Copy link
Owner

mbnuqw commented Mar 3, 2024

Does sorting on TITLE also consider the custom (edited/renamed) titles?

Yes

@JohnVKRDam
Copy link

THANK YOU! You have turned this into one hell of a beautiful day ;-) hahaha

@alexander-paterson
Copy link

This is amazing. Thanks!

@ongots
Copy link

ongots commented Mar 3, 2024

You must first sort by second-level domain and then by third-level domain, otherwise tumblr blogs will be scattered throughout the panel.

The panel button menu is not localized.

@JohnVKRDam
Copy link

JohnVKRDam commented Mar 4, 2024

Sorting seems to work well. It's truly a HUGE improvement towards better tab/group management!
The two options mentioned above will also be great to have! The [the domain name: top-level/sub domain, reverse sorting] and [sort groups be fore tabs].

There is one more thing I noticed and is giving me some troubles. It's the numerical sorting method.

Currently, numbers are sorted alphabetically, using the binary method. That means, 11 comes before 2, because 1 is smaller than 2 in the alphabet, as each character is analyzed by POSITION, rather than considering the WHOLE string (as a number value).

It would make more sense to use logical sorting, where 11 comes after 2, because the NUMERICAL VALUE is greater.

Is it possible to use true logical numerical sorting?
What I mean is the following:

I have these named tabs:
1
2
11
211
When I sort them, the result is:
1
11
2
211
I would expect:
1
2
11
211

That wreaks havoc on many of the named group and tab trees I have. I have a lot of tabs that are numbered incrementally and the only option I have now is to resolve this, would be to add leading zeros to all the tabs. That's not great, considering I have many hundreds of tabs, with lots and lots of them numbered ;-) haha

If this is not possible, I totally understand. After all, it is not the job of the extension (and you, the programmer) to solve everyone's 'problems' ;-) but it would certainly be great to have.

Thank you! :-)

@ongots
Copy link

ongots commented Mar 5, 2024

The tab with a third-level domain consisting entirely of numbers appears at the top, ignoring the second-level domain.

Current incorrect sort order:
https://111.tumblr.com/
https://flickr.com/
https://9of100.tumblr.com/
https://lightresist.tumblr.com/

@mbnuqw
Copy link
Owner

mbnuqw commented Mar 5, 2024

The tab with a third-level domain consisting entirely of numbers appears at the top, ignoring the second-level domain.

Fixed. Now it will be sorted like that:
https://flickr.com/
https://9of100.tumblr.com/
https://111.tumblr.com/
https://lightresist.tumblr.com/

Note: "9of100" comes before "111" due to numerical sorting.

@mbnuqw
Copy link
Owner

mbnuqw commented Mar 7, 2024

Closing this issue as implemented in v5.2.0.

@mbnuqw mbnuqw closed this as completed Mar 7, 2024
@rafo
Copy link
Author

rafo commented Mar 8, 2024

Thanx!

@the-a-man-006
Copy link

the-a-man-006 commented Mar 17, 2024

Just switched from TST. Thanks so much, @mbnuqw .

Just one request,

  • can the sorting be made permanent/synchronous?
    So for example, when sorted by access-time (recent to old), clicking on an old tab should refresh the sidebar or drag it up all the way; likewise, creating new tabs in focus should spawn them at the top.
    Right now, one has to open the context menu and re--sort-by-access again and again.

Basically, automatically-sort-on-tab-switch BY (creation/access/title/container/url).
A panel-level / per-panel setting maybe.
I, personally, am only interested in auto-sort for last-access though.

Thereupon, you can even do away with:
new-tabs-open-at (top/bottom) setting.

Would make it the God-Mode for productivity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants