Keyconfig extension: Firefox: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (deleted user.js in the first line)
Line 1: Line 1:
:''These are example lines you can add to Firefox's [[prefs.js]] or [[user.js]] files to customize keyboard shortcuts. You need to install [[keyconfig extension]] first. A [[Keyconfig extension - Custom Keys for Thunderbird|similar page for Thunderbird]] is available.''
:''These are example lines you can add to Firefox's [[prefs.js]] file to customize keyboard shortcuts. You need to install [[keyconfig extension]] first. A [[Keyconfig extension - Custom Keys for Thunderbird|similar page for Thunderbird]] is available.''


==Firefox General==
==Firefox General==

Revision as of 23:13, 1 February 2005

These are example lines you can add to Firefox's prefs.js file to customize keyboard shortcuts. You need to install keyconfig extension first. A similar page for Thunderbird is available.

Firefox General

user_pref("keyconfig.main.xxx_key__Extensions", "!][][][BrowserOpenExtensions('extensions');");
user_pref("keyconfig.main.xxx_key__Manage Bookmarks", "!][][][toOpenWindowByType('bookmarks:manager', 'chrome://browser/content/bookmarks/bookmarksManager.xul');");
user_pref("keyconfig.main.xxx_key__Next Tab", "!][][][gBrowser.mTabContainer.advanceSelectedTab(1);");
user_pref("keyconfig.main.xxx_key__Previous Tab", "!][][][gBrowser.mTabContainer.advanceSelectedTab(-1);");
user_pref("keyconfig.main.xxx_key__Reload All Tabs", "!][][][gBrowser.reloadAllTabs();");
user_pref("keyconfig.main.xxx_key__Themes", "!][][][BrowserOpenExtensions('themes');");
user_pref("keyconfig.main.xxx_key__Close Tab & Focus to the left", "!][][][var tab = gBrowser.mCurrentTab; if(tab.previousSibling) gBrowser.mTabContainer.selectedIndex--; gBrowser.removeTab(tab);");
user_pref("keyconfig.main.xxx_key__Close Tab & Focus to the right", "!][][][var tab = gBrowser.mCurrentTab; if(tab.nextSibling) gBrowser.mTabContainer.selectedIndex++; gBrowser.removeTab(tab);"); 

Keybinding for Bookmark Keyword (replace KEYWORD with your keyword):

user_pref("keyconfig.main.xxx_key__Keyword 1", "!][][][if(window.loadURI) loadURI(getShortcutOrURI('KEYWORD',{}));");

Back Menu (like right-clicking the Back Button; if the menu is too low, decrease the 25, if it is too high, increase it):

user_pref("keyconfig.main.xxx_key__Back Menu", '!][][][var elm = document.getElementById("back-button"); var x = elm.boxObject.x; var y = elm.boxObject.y + elm.boxObject.height + 25; document.getElementById("backMenu").showPopup(elm, x, y, "popup", null, null);');

Forward Menu (like right-clicking the Forward Button):

user_pref("keyconfig.main.xxx_key__Forward Menu", '!][][][var elm = document.getElementById("forward-button"); var x = elm.boxObject.x; var y = elm.boxObject.y + elm.boxObject.height + 25; document.getElementById("forwardMenu").showPopup(elm, x, y, "popup", null, null);');

Focus Content (activate the content, where the page is showed, as if you would click on it; you need this for example when you want to scroll with the cursor keys and nothing happens):

user_pref("keyconfig.main.xxx_key__Focus Content", "!][][][_content.focus();");

Scrolling:

user_pref("keyconfig.main.xxx_key__Page Down", "!][][][goDoCommand('cmd_scrollPageDown');");
user_pref("keyconfig.main.xxx_key__Page Up", "!][][][goDoCommand('cmd_scrollPageUp');");
user_pref("keyconfig.main.xxx_key__Scroll Bottom", "!][][][goDoCommand('cmd_scrollBottom');");
user_pref("keyconfig.main.xxx_key__Scroll Top", "!][][][goDoCommand('cmd_scrollTop);");

Extensions

Googlebar

user_pref("keyconfig.main.xxx_key__Googlebar - Clear search history", "!][][][googlebarClearHistory( true )");
user_pref("keyconfig.main.xxx_key__Googlebar - Up a directory", "!][][][googlebarUp(event)");

Highlight search terms (toggle):

user_pref("keyconfig.main.xxx_key__Googlebar - Highlight search terms", "!][][][googlebarHighLightInPage()");


Menu Editor

user_pref("keyconfig.main.xxx_key__Menu Editor", "!][][][openDialog('chrome://menuedit/content/menueditprefs.xul',, 'resizable');");


miniT or Tab Mix

user_pref("keyconfig.main.xxx_key__Move Tab -> End", "!][][][gBrowser.moveTabTo(gBrowser.mCurrentTab,gBrowser.mTabContainer.childNodes.length-1);");
user_pref("keyconfig.main.xxx_key__Move Tab -> Left", "!][][][if(gBrowser.mCurrentTab.previousSibling) gBrowser.moveTabTo(gBrowser.mCurrentTab,gBrowser.mCurrentTab.ordinal-1);");
user_pref("keyconfig.main.xxx_key__Move Tab -> Right", "!][][][if(gBrowser.mCurrentTab.nextSibling) gBrowser.moveTabTo(gBrowser.mCurrentTab,gBrowser.mCurrentTab.ordinal+1);");
user_pref("keyconfig.main.xxx_key__Move Tab -> Start", "!][][][gBrowser.moveTabTo(gBrowser.mCurrentTab,0);");


Enhanced Bookmark Search

Open "Bookmarks > Search Bookmarks":

user_pref("keyconfig.main.xxx_key__Search Bookmarks", "!][][][window.openDialog('chrome://bcpm/content/findBookmark.xul', 'FindBookmarksWindow', 'dialog=no,centerscreen,resizable=no,chrome,dependent');");


SessionSaver

user_pref("keyconfig.main.xxx_key__SessionSaver - Capture Default Session", "!][][][SessionSaver.hiddenObserver.observe(null, 'SessionSaver-CaptureAll', null);");
user_pref("keyconfig.main.xxx_key__SessionSaver - Restore Default Session", "!][][][SessionSaver.sessionRecall(null, SessionSaver.prefBranchStatic + SessionSaver.staticBranchDefault)");
user_pref("keyconfig.main.xxx_key__SessionSaver - Capture New Session", "!][][][SessionSaver.sessionPrompt();");