Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Open external tabs as child of current tabs #2391

Closed
prashantkhurana opened this issue Oct 14, 2019 · 6 comments
Closed

[feature request] Open external tabs as child of current tabs #2391

prashantkhurana opened this issue Oct 14, 2019 · 6 comments
Labels

Comments

@prashantkhurana
Copy link

Currently there is an option "New tab with same website as the current tab from location bar or from outside firefox". This is a feature request to have a similar option but without the same website requirement.

Usecase : I sometimes open lots of links from slack (which are related to the current work I am doing. I would like them to open in the current tree I am on, which is generally the tree related to the work I am doing.

@piroor
Copy link
Owner

piroor commented Oct 15, 2019

I agree that such an option may be useful, if TST can detect a tab was opened with the context exactly matching to the story. But sadly it looks not effective for now, because WebExtensions API provides just restricted ability to detect the context of a tab open.

The first checkpoint is openerTabId of a newly opened tab. When openerTabId is provided, it means that the tab was opened from another existing tab with some triggers:

  • Middle click on a link
  • Regular click on a link with target
  • window.open() called by scripts running on a page

The second checkpoint is the session data accessible via getTabValue(). When the tab has any session data, then it is one of these cases:

  • Duplicated tab by middle click on back/forward/reload button in the navigation toolbar, if there is any existing tab with same session data.
  • Reopened (restored) tab with Ctrl-Shift-T, if there is no existing tab with same session data.

The third checkpoint is the URL. When the tab has the URL about:newtab, the tab is:

  • New blank tab by Ctrl-T or clicking on the + button

After these filters how the context is narrowed? Sadly there are still many cases:

  • New tab from a bookmark
  • New tab from a history entry
  • New tab from a dropped URL text
  • New tab from a dropped non-URL text (search by the default search engine)
  • New tab with/without URL by Alt-Enter on the location bar
  • New tab with/without URL by any other addon
  • New tab with/without URL by any other application (or the OS itself)
  • And all other cases

The option "New tab with same website as the current tab from location bar or from outside Firefox" affects to all of them, when the URL of the tab has an origin same to the active tab. So the option you suggested will affect all these cases when their URL has an origin different from the active tab.

Honestly I think this is too wide, and the option virtually means "how open tabs by default". Then relation of tabs may not mean nothing anymore - a parent tab does not mean the originator of its descendants, a descendant tab does not mean related to its ancestors. It is horrible for me, and it looks hard for me to find a target tab from them, harder than the case with completely flat list of tabs...

@prashantkhurana
Copy link
Author

Oh wow, thanks for thinking this through! I agree that since firefox does not provide any way to find out if the tab was opened from other application, this would essentially translate to "how to open tabs by default".

For completeness, as a compromise since I still I open tabs from outside firefox a lot of time I ended up using open-tabs-next-to-current extension which opens a child always by default(unless I am on last child).

@irvinm
Copy link
Contributor

irvinm commented Oct 16, 2019

@prashantkhurana can you close this item for now? Maybe we can revisit if Firefox adds functionality to help this.

@piroor
Copy link
Owner

piroor commented Oct 28, 2019

I've realized that there is the fourth checkpoint: it is focus of windows. When all Firefox window lose focus, windows.Window.focus of all windows become false, and a listener for windows.onFocusChanged receives -1 as the last focused window. So, when a new tab is opened while no Firefox window had focus, the tab is:

  • New tab from a dropped URL text from any other application
  • New tab from a dropped non-URL text (search by the default search engine) from any other application
  • New tab with/without URL by any other application (or the OS itself)

Rest cases:

  • New tab from a bookmark
  • New tab from a history entry
  • New tab from a dropped URL text from Firefox itself
  • New tab from a dropped non-URL text (search by the default search engine) from Firefox itself
  • New tab with/without URL by Alt-Enter on the location bar
  • New tab with/without URL by any other addon
  • New tab from Firefox's UI like about:addons
  • And all other cases

As listed above the case New tab with/without URL by any other application (or the OS itself) is still not detectable. But I think we've moved toward a little.

@piroor
Copy link
Owner

piroor commented Oct 28, 2019

Finally I've realized that all new tabs opened while no Firefox window has focus are detectable as "opened from external applications". New tabs via drag and drop from other applications are also treated just as a part of this case. So I've introduced a new option very similar to the one suggested by you with these commits:

@piroor piroor added the fixed label Oct 28, 2019
@prashantkhurana
Copy link
Author

Can't thank you enough for thinking about this feature so much and ultimately adding something that works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants