rNeomy / tab-suspender

Automatically suspend (hibernate) inactive tabs to free up system resources; This project is discontinued in favor of https://add0n.com/tab-discard.html
http://add0n.com/tab-suspender.html
Mozilla Public License 2.0
112 stars 32 forks source link

Request - display a screenshot instead of coffee logo #63

Open d33tah opened 7 years ago

d33tah commented 7 years ago

Hi!

I recently switched from Chromium where I used "The Great Suspender". It had this feature that when a tab got suspended, it was replaced with a screenshot that one could read. Is there a chance you would add such feature?

EC-O-DE commented 7 years ago

+1 for perhaps small/medium size preview/reminder - but as option.

Any specific reason why u stopped using that other ext? Me myself trying to find most lightweight suspender with good feature set. Neomy's seems like the one.

hyunh90 commented 7 years ago

Currently, there is no official way to make screenshot directly from the page, except the page inside an IFrame. However, there is an interesting way of generating a screenshot using canvas; looks very promising, except that I'm not sure the limitations can be overcome at the extension level.

victorb commented 7 years ago

Currently, there is no official way to make screenshot directly from the page

Oh, but there is! I've used it for another extension to take screenshots of a page. There is a example of it working here: https://github.com/VictorBjelkholm/ipfs-screenshoter/blob/d3f0da4e8053dfc6e88d71a35871ac153e63a5ab/background.js#L30-L64

hyunh90 commented 7 years ago

Huh, that did slip through my hand; was searching MDN with the term 'screenshot' only. XD

hyunh90 commented 6 years ago

I've been trying to implement this and thinking about how to 'store' the screenshot image; for now, I can think of two ways:

And here are the pros & cons of either case:

Any opinion on this?

victorb commented 6 years ago

@hyunh90 storage.local approach sounds good, and I don't think you have to request the unlimitedStorage permission just yet.

Firefox enables you to ask for the "unlimitedStorage" permission from version 56 onwards. It does not yet restrict the amount of data your extension can store, but will start doing so in a future release: so it's a good idea to ask for the "unlimitedStorage" permission now, if you intend to store a large amount of data.

Chrome is currently limiting the storage to 5MB, and I don't think even that limit would be hit, since as soon as the page is loaded again, you can clear the screenshot data.

Guess it would be good to do a quick measurement and see how many tabs you can screenshot and save to the storage, before hitting Chrome's limit (Firefox probably end up with about the same I'm guessing)

hyunh90 commented 6 years ago

Yes, I also thought that to minimize the footprint of the suspend page the extension should drop the image data to somewhere whenever the tab loses focus and reprint when it gains focus; for this, storage.local is the only applicable, I guess.

I will try to implement with storage.local.

d33tah commented 6 years ago

Why not both?

d33tah commented 6 years ago

I mean, the user might be notified that storage.local is only for storing screenshot, might have privacy implications but fewer usability problems. If user says no but still enables the feature, then data: (and perhaps a suggestion to reconsider the choice) sounds like a solution. The con is that this is most complicated, but probably has best UX.