NiklasGollenstede / unload-tabs

WebExtension that unloads tabs and prevents tabs from loading
https://addons.mozilla.org/addon/unload-tabs/
Mozilla Public License 2.0
69 stars 13 forks source link

Allow to switch to unloaded tabs with the "Switch to Tab" feature from new tabs #18

Open NiklasGollenstede opened 6 years ago

NiklasGollenstede commented 6 years ago

Situation: When using the URL-bars "Switch to Tab" feature from new tabs (never navigated), Firefox closes the tab and intentionally switches to a possibly unloaded tab. UnloadTabs prevents that:

Email conversation

>> I wonder if [detecting about:newtab] will work with extensions that change the new tab > >No it would not. That is one thing I had in mind when I wrote “There will certainly be some edge-cases to consider”. There would need to be a preference to adjust the new tab page (but it would probably be rather difficult for the user to get the correct URL). > >> “focus jump distance” might work as good metric > >This does indeed seem like a better idea. It may not even need to be optional. The only other situation I know of where Firefox jumps to a non neighboring tab (on close), is when you just opened the closing tab, and in this situation it is rather unlikely that the previous tab is not loaded. > >Thanks for your further input! > >On 2018-05-10 04:54, miloss wrote: > >> Thanks for your reply and explanation. I completely forgot that firefox closes the blank tab used for search. >> Yes, non-blank tab is not closed when I switch-to-tab. It feels wrong editing tab I want to keep, but works as good workaround. >> >> I wonder if this method will work with extensions that change the new tab, for example "new tab tools". For firefox it looks like blank tab, because it gets closed when I use "switch to tab", but I am not sure how it will appear to your extension. >> >> >> Also, I don't think that exempting all blank tab closes will work well in my case, as I sometimes forget a blank tab around and later manually close it. Even though I, personally, prefer dealing with mis-loaded tab next to manually closed blank tab to losing comfortable "switch to tab", but I am afraid it is a bad idea to solve an easy to understand problem "broken switch to tab" by creating obscure problem "unloaded tabs sometimes load". Maybe, until better solution is found, make it a configuration option "Support for SwitchToTab (experimental)" that will document this tradeoff? >> >> I am thinking... how complex is the current firefox "on blank tab close" behavior? Can you model it and block only tab switches that match? Alternatively, I think "focus jump distance" might work as good metric. I expect most users to only use "switch to tab" when they don't spot the target tab on the screen, e.g. only to reach tabs far away. >> >> >> Have a nice day! >> >> Niklas Gollenstede wrote: >>> Interesting. I wasn’t aware of this, because I have the “Switch to Tab” >>> thing disabled. >>> >>> It is not directly possible to detect when the feature is used, but as >>> far as I saw, Firefox only closes the current tab if it is a tab that >>> has not been used yet. >>> So a pretty close approximation would be to assume the future is used >>> when a |about:newtab| (the default URL of new tabs, even if it is not >>> displayed) tab closes. >>> There will certainly be some edge-cases to consider, but the basic >>> behavior could be to ignore the close event of tabs if their URL is >>> |about:newtab|. >>> >>> I just added a note in the source code so that I won’t forget it, but I >>> can’t tell you when I will find time to implement this. I’m rather busy >>> at the moment … >>> >>> On 2018-05-08 14:44, miloss wrote: >>> >>>> Thanks for this update, close last tab now works with a notification. >>>> That is equally good to opening new blank tab like pre-webextension did. >>>> >>>> >>>> But I have missing feature to report. >>>> Open new tab, type title of other open-unloaded tab, select one of "switch to tab" options in drop-down. >>>> Can you tell this situation from other tab loading and allow it? >>>> >>>> Thanks. >>>> ​