Open fatjing opened 5 years ago
I am also interested because this works in Vimium in their createTab
function.
This is quite useful because with the Dark Reader
extension the about:newtab
page is dark instead of white.
This is quite useful because with the Dark Reader extension the about:newtab page is dark instead of white.
https://superuser.com/a/1400442 specifies to edit browser.display.background_color
in about:config
to a dark color which does the job for the about:blank
page, so that helps.
But apparently, on hitting on
, in the tab Firefox's location bar is not initially highlighted as it would be when one hits cmd+t
(in macOS).
I glanced over the code in vimium
and in main.js
they are using this code and even mention the issue with about:newtab
but I have had no luck patching this into SurfingKeys :(
// Firefox does not support "about:newtab" in chrome.tabs.create.
if (winConfig["url"] === Settings.defaults.newTabUrl)
delete winConfig["url"];
return chrome.windows.create(winConfig, callback);
I tested this in Chrome and there the key sequence on
works just as one would expect: It opens a new tab and focuses the location bar.
The code below works but one has to recompile the extension. It redirects about:blank
to about:newtab
:
function openUrlInNewTab(currentTab, url, message) {
var newTabPosition;
if (currentTab) {
switch (conf.newTabPosition) {
case 'left':
newTabPosition = currentTab.index;
break;
case 'right':
newTabPosition = currentTab.index + 1;
break;
case 'first':
newTabPosition = 0;
break;
case 'last':
break;
default:
newTabPosition = currentTab.index + 1 + chromelikeNewTabPosition;
chromelikeNewTabPosition++;
break;
}
}
let tabConfig = {
url: url,
active: message.tab.active,
index: newTabPosition,
pinned: message.tab.pinned,
openerTabId: currentTab.id
};
if (url === "about:blank") {
delete tabConfig["url"];
}
chrome.tabs.create(tabConfig, function(tab) {
if (message.scrollLeft || message.scrollTop) {
tabMessages[tab.id] = {
scrollLeft: message.scrollLeft,
scrollTop: message.scrollTop
};
}
});
}
Error details
SurfingKeys: 0.9.45
Browser: firefox 68.0.1 / windows 10
Context
doesn't work