jscher2000 / switch-to-previous-active-tab

Firefox toolbar button to switch to the last accessed tab (and MRU popup)
Mozilla Public License 2.0
8 stars 1 forks source link

Exclude hidden tabs from listing until they are unhidden again #9

Closed mystiquewolf closed 2 years ago

mystiquewolf commented 3 years ago

Certain Firefox extensions like Tab Stash hide some of the tabs. After they are hidden they are still listed in the list of recently switched tabs.

I don't know what clicking them would do but i believe it would activate and unhide them. I don't want to test this because it might break some logic in the Tab Stash extension.

TL;DR: The tab list in switch-to-previous-active-tab should not be polluted with hidden tabs.

jscher2000 commented 3 years ago

Thank you for this note. I hope to find time to test later this week.

mystiquewolf commented 3 years ago

I've been looking at the code.

If not too late to save some research - i think in initObjects() you'll have to use browser.tabs.query({ hidden: false });.

Maybe an option can be added whether to reload hidden tabs and a check in reloadAll() if the .hidden property gives true.

You'll also have to add browser.tabs.onUpdated.addListener(listener, {properties: ["hidden"}); to add/remove the tab from the oTabs's lists depending on the new value.

jscher2000 commented 3 years ago

Thanks. Version 2.0 is live with this change. I only updated the quick switching behavior (the toolbar button or the keyboard shortcut). On the list, the hidden/discarded tabs still appear, but with diagonal shading in the background. At this point, they can be clicked to open; I'm not sure whether to completely hide them or whether that is enough to avoid accidentally redisplaying them.

mystiquewolf commented 3 years ago

Some issue i found:

jscher2000 commented 3 years ago

I don't know where the ZZZ came from. ??

The skip list is related to the button/keyboard shortcut functionality, it is not applied to the tab list.

I see your point about hiding a bunch of tabs at once but I don't have an immediate idea of how best to update the list.

mystiquewolf commented 3 years ago

Don't worry, the "ZZZ" is not some illuminati-injected code in your extension. It's from the "Auto Tab Discard" extension. 😁

So i may write some pull request if i get some time but i don't know if or when.

jscher2000 commented 2 years ago

Hidden tabs are now omitted from the lists in version 2.0.1.

mystiquewolf commented 2 years ago

Thank you for the extension and the change, now it's even better!