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
906 stars 79 forks source link

Enhancement: Support configurable regexes for automatic closing/removal/trashing of discarded tabs #260

Open tonycpsu opened 2 years ago

tonycpsu commented 2 years ago

It would be useful if the "Permanently delete (remove) old discarded tabs if they are inactive for (in hours)" option supported a list of regex rules, similar to the "Only discard the following inactive hostnames or regular expression rules1" configuration, where discarded tabs are only trashed if the configured time has elapsed and the URLs match a user-supplied list.

The use case is for situations where you have certain sites that you open tabs for but those tabs become less relevant over time and you're okay with them being closed for you.

A supercharged version of this feature could allow for the regexes to each have a number of seconds for them, so you could say site A tabs automatically disappear after 7 days, site B's tabs disappear after 30 days, etc.

I'd be happy to take a stab at this if you'd accept a PR.

rNeomy commented 2 years ago

I'd be happy to take a stab at this if you'd accept a PR.

Sure! You just need to update the "trash" plugin; https://github.com/rNeomy/auto-tab-discard/tree/master/plugins/trash Have a filter for keys and remove the keys that are not supposed to be checked.

A supercharged version of this feature could allow for the regexes to each have a number of seconds for them

The trash check fires every half an hour, so it is technically possible to use the default value or the one that is part of the user request. We can have domain@24h or re:...@24h format to support the custom period.

AJolly commented 2 years ago

It'd be useful if this let us close/discard other extension pages as well - example chrome-extension://edacconmaakjimmfgnblocblbcdcpbko/main.html