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

Support Chrome Tab groups? #4

Open
orschiro opened this issue Jun 16, 2021 · 9 comments
Open

Support Chrome Tab groups? #4

orschiro opened this issue Jun 16, 2021 · 9 comments

Comments

@orschiro
Copy link

Hey @LAJW !

This is a beautiful extension.

Would it be possible to support Chrome's new tab groups to offer a new sub-menu called "Recently Closed Tab Groups"?

@LAJW
Copy link
Owner

LAJW commented Jun 16, 2021 via email

@orschiro
Copy link
Author

orschiro commented Jun 16, 2021 via email

@LAJW
Copy link
Owner

LAJW commented Jun 16, 2021

I had a quick look. I can't rely on Chrome API for this. I'll have to keep track of groups manually. Otherwise it would already be on its way to you.

Thankfully in the meantime you can still restore tabs individually, which will recreate the groups, albeit with a few more clicks.

I have an idea how to make this work, but it might take a little longer.

@LAJW
Copy link
Owner

LAJW commented Jun 17, 2021

I did more digging. Looks like I need to update to the new Chrome API (Manifest V3) to even access these things. I tried doing that, but Chrome forgot to implement favicons - they're supposed to be obtained in a different way, but they just give me empty strings. And that's for closed tabs, I couldn't find favicon support for history entries.

They really dropped the ball here. I'll see if it's broken on the beta channel and if it is, file a bug.

@orschiro
Copy link
Author

orschiro commented Jun 17, 2021 via email

@LAJW
Copy link
Owner

LAJW commented Jun 17, 2021

Initially, yes, as a quick hack. But this causes problems (when closing all tabs to the right, or all other tabs). It could work, but tab's groupId is set to 0 (without the tab group API enabled).

There's a new API dedicated to handling "on tabgroup deleted"/updated/etc. events (and presumably populates that groupId field), which I wanted to hook into, but it's a new API that requires an upgrade to Manifest V3.

@orschiro
Copy link
Author

orschiro commented Jun 17, 2021 via email

@LAJW
Copy link
Owner

LAJW commented Nov 2, 2022

Ported to Manifest V3 - Google reenabled favicon API.

Sadly, Tabgroup API is (still) limited (and sessions/history API has no notion of tabgroups). I can detect tab groups being closed/created, but tab IDs are not stable, so when you restart the browser, even if I record which tab belongs to which group, I can only identify them by their URLs. Which would be fine most of the time, but I can envision edge cases where it'll break:

  • I can still restore only one tab at a time
  • restoring large (25+) tab groups might not work (because there's an upper limit on how many closed tabs you can fetch)
  • tabs with the same URL as the one in the closed group might be reopened accidentally/break closed tab group continuity
  • can't detect that a tab group was reopened (if it was reopened outside of the extension)

So, the behavior would be glitchy. Until now I stuck with relying on native APIs for everything and people have been happy with it. I'd have to think about it more.

@orschiro
Copy link
Author

orschiro commented Nov 2, 2022 via email

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

2 participants