rNeomy / auto-tab-discard

Use native tab discarding method to automatically reduce memory usage of inactive tabs
https://webextension.org/listing/tab-discard.html
Mozilla Public License 2.0
909 stars 79 forks source link

[Feature Request] Auto-Discard new tabs #226

Closed zaser321 closed 3 years ago

zaser321 commented 3 years ago

Is it possible to add an option to auto discard new tabs. I sometimes read a page with a lot of links and sources that I want to chek out later so I just open them in a new tab.

Also (not in title), is there a way to make Chrome's right clicking on a tab to list also as an option "Discard tab/group"?

rNeomy commented 3 years ago

Is it possible to add an option to auto discard new tabs.

Not exactly what you needed though we already have a context menu item for links to open a tab in the discarded state. Anyhow we can have a new plug-in for this.

Also (not in title), is there a way to make Chrome's right clicking on a tab to list also as an option "Discard tab/group"?

Unfortunately not! Chrome does not allow extensions to add items to this context.

grahamperrin commented 3 years ago

Thanks, the feature is not yet working for me (tested with https://bsd-hardware.info/?probe=cdeafa0952 opened into a new tab). Maybe I need to quit then start Firefox 88 for it to become effective …

… still not working, sorry:

https://user-images.githubusercontent.com/192271/115834377-1479f880-a40d-11eb-972e-5183c9ee47db.mp4

Reproducible with a separate profile with Auto Tab Discard alone enabled.

grahamperrin commented 3 years ago

Also, please: is it possible for this new plug-in (or a separate plug-in) to open a tab in the discarded state without first loading the tab?

Whilst the load first approach is ideal when it's desirable to gain the title of a page, there's also a use case that (for performance) requires nothing more than the URL in the discarded tab.

Thanks

rNeomy commented 3 years ago

the feature is not yet working for me

Right. I forgot to check in FF. We are having two issues here:

  1. chrome.tabs.onCreated.addListener is called too soon when the page does not have a URL so the extension gets permission denied when trying to inject the code. This is fixed now by overwriting this function.
  2. Even when the page has a DOM, still discarding the tab ruins the tab. So we needed to wait even more.

So in FF, this plug-in works as follows: The extension waits for the tab to have a valid title. Then discards it after one second (this still may cause issues on low-performance systems). Please give the latest commit a try and report back.

rNeomy commented 3 years ago

Also, please: is it possible for this new plug-in (or a separate plug-in) to open a tab in the discarded state without first loading the tab?

Not really. Even after a one-second delay still discarding is not stable. However, you can use the Open Link in New Discarded Tab to discard immediately.

grahamperrin commented 3 years ago

… Please give the latest commit a try and report back.

Please don't think me lazy but I'll probably await the next release. Thanks

grahamperrin commented 3 years ago

For clarity


Discard all newly opened inactive tabs after they get loaded


Open in New Discarded Tab (link context menu option)

grahamperrin commented 3 years ago

https://github.com/rNeomy/auto-tab-discard/issues/226#issuecomment-826041623

… Please give the latest commit a try and report back.

Thank you. The feature does seem to work reliably for me, with multiple profiles, with version 0.4.7 of the extension.

If I understand correctly, using this feature effectively ignores the list of exceptions:

grahamperrin commented 3 years ago

231