saka-key
saka-key copied to clipboard
Open in new tab next to current
First of all, thanks for this great extension! :tada:
On Firefox, if I click F
(i.e. open in new tab, with vimium bindings), the tab ends up being the last of the list.
Firefox's default behaviour when right-clicking on a link, is instead to open it next to the current one (and that was VimFx's behaviour as well, if that matters).
Thanks. Opening a new tab to the right of the current one makes sense. Fix should be easy.
VimFx uses a pretty weird way to open links in new tabs in order to respect the user's settings and other add-ons: https://github.com/akhodakivskiy/VimFx/blob/376486f4dc61d75add1c26263d1f4baf39d3abd4/extension/lib/commands.coffee#L536-L548
In other words, the default behavior of VimFx is to follow the default behavior of Firefox. The default behavior of Firefox is to:
- Open a tab to the right of the current one.
- Then to the right of that the new tab.
- Then to the right of that the new new tab.
- And so on, until you visit another tab. Then it resets to 1 again.
In other words:
[TabA] [TabB]
- select TabA
- open link in new background tab
→
[TabA] [Child1] [TabB]
- open link in new background tab
→
[TabA] [Child1] [Child2] [TabB]
- open link in new background tab
→
[TabA] [Child1] [Child2] [Child3] [TabB]
- select any other tab
- select TabA again
- open link in new background tab
→
[TabA] [Child4] [Child1] [Child2] [Child3] [TabB]
Huh, that's pretty interesting. As usual, thanks for the explanation. Subtle details like this are easy to miss.
I think everyone has missed something about this one.
But, first, since this is my first comment here, let me say since Vimperator is virtually dead, I was thrilled to find Saka key. It is great and beautifully designed.
The point is Firefox has a setting for this. And, SakaKey is, from what I can see, ignoring this setting.
The setting is: browser.tabs.insertRelatedAfterCurrent
Since I can control this in Firefox, I really wouldn't want Saka Key to control it for me (except perhaps to make it something I can change in Saka Key).
From what have found out, this setting relates to opening a link that is ON THE CURRENT PAGE ONLY. It considers such links "related" and thus, BY DEFAULT, opens them in the tab after the current. Personally, I really like this behavior and hope Saka Key can be "fixed" so as to respect this setting.
More information here : https://bugzilla.mozilla.org/show_bug.cgi?id=528005 and elsewhere.
Joe Petree
@joefiesta WebExtensions have access to neither the browser.tabs.insertRelatedAfterCurrent
pref nor the code for opening new tabs like when using the context menu on a link, so unlike VimFx they can't respect that. The feature (and possibly the option) has to be re-implemented (or we have to wait for a WebExtension API).
Lydell,
thanks for the informative reply. I don't write extensions, so all this new stuff with Firefox's change to the new API is new to me.
What about a hack? Saka key can MOVE a tab. How about getting the info about the current tab, opening the new tab and then moving it next to the "parent/related" tab? I could this with Autohotkey, if I can find the current tab number and number of current tabs.
Idea two, but I guess I know the answer: Can Saka Key move the cursor to over the focused link?
Idea three: If it can't move the cursor, can it tell me the screen position of the focused link?
@joefiesta What you describe is not a hack. It's called re-implementing the feature. That's what will be done when somebody gets the time to do it.
Regarding cursor and screen stuff, let's not go off topic.
Just confirming @joefiesta
- Your ideas are features exposed by DOM and webextensions APIs
- The limiting factor this feature (and for most features/bug fixes) is time not ingenuity. This is probably an easy bug for beginners if you want to take a stab at it.
Since this can be simply configured in Firefox, in url about:config?filter=browser.tabs.insertAfterCurrent
and the aforementionned browser.tabs.insertRelatedAfterCurrent
maybe it's worth putting this on some Tips or FAQ page rather than trying to implement it with code. It's better to concentrate on features that can't be hacked easily.