The following code snippet works for me using the browser console.
Code: Select all
(function () {
var keyset = document.getElementById("mainKeyset");
var key = document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_prevTab");
key.setAttribute("keycode", "VK_F1");
key.setAttribute("oncommand", "gBrowser.tabContainer.advanceSelectedTab(-1, true);");
keyset.appendChild(key);
var key = document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_nextTab");
key.setAttribute("keycode", "VK_F2");
key.setAttribute("oncommand", "gBrowser.tabContainer.advanceSelectedTab(1, true);");
keyset.appendChild(key);
var key = document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_newNavigatorTabNoEvent");
key.setAttribute("keycode", "VK_F4");
key.setAttribute("oncommand", "BrowserOpenTab();");
keyset.appendChild(key);
var key = document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_close");
key.setAttribute("key", "x");
key.setAttribute("modifiers", "alt");
key.setAttribute("oncommand", "BrowserCloseTabOrWindow(event);");
keyset.appendChild(key);
})();
Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line
Here is the mozilla.cfg file.
Code: Select all
// mozilla.cfg file needs to start with a comment line
Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(function (aSubject, aTopic, aData) {
var chromeWindow = aSubject;
chromeWindow.setTimeout(function () {
try {
var keyset = chromeWindow.document.getElementById("mainKeyset");
var key = chromeWindow.document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_prevTab");
key.setAttribute("keycode", "VK_F1");
key.setAttribute("oncommand", "gBrowser.tabContainer.advanceSelectedTab(-1, true);");
keyset.appendChild(key);
var key = chromeWindow.document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_nextTab");
key.setAttribute("keycode", "VK_F2");
key.setAttribute("oncommand", "gBrowser.tabContainer.advanceSelectedTab(1, true);");
keyset.appendChild(key);
var key = chromeWindow.document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_newNavigatorTabNoEvent");
key.setAttribute("keycode", "VK_F4");
key.setAttribute("oncommand", "BrowserOpenTab();");
keyset.appendChild(key);
var key = chromeWindow.document.createXULElement("key");
key.setAttribute("id", "gregzilla_key_close");
key.setAttribute("key", "x");
key.setAttribute("modifiers", "alt");
key.setAttribute("oncommand", "BrowserCloseTabOrWindow(event);");
keyset.appendChild(key);
} catch (e) {
Components.utils.reportError(e);
};
}, 1000);
}, "browser-delayed-startup-finished", false);
Reference
view-source:chrome://browser/content/browser.xhtml
view-source:chrome://browser/locale/browser.dtd
Firefox 70.0.1
Windows 7 SP1 32-bit