-
Notifications
You must be signed in to change notification settings - Fork 280
Code snippets for custom keyboard shortcuts
Charles edited this page Apr 1, 2016
·
21 revisions
Firefox already have very large number of keyboard shortcuts, and other addons also provide their own keyboard shortcuts, I cannot find out safe combinations for my features. So I gave up and decided to provide only APIs for other addons. Please use generic addons to customize keyboard shortcuts which can define custom actions based on scripts. Sorry.
See also:
- Wiki page collecting keyboard shortcuts · Issue #669
- Toggle hotkey · Issue #156
- Feature Request: Close Group Shortcut · Issue #274
- Keyboard Shortcuts for modifying tree · Issue #772
- Supporting PageUp, PageDown, Home, End keys in the tab list · Issue #836
- caicui's Vimperator plugin to operate tabs with TST
Firefox has its own keyboard shortcuts to move focus between tabs, but they are deactivated by default. You need to activate it by userChrome.css like:
.tabbrowser-tab {
-moz-user-focus: normal !important;
}
By the way, Ctrl-PageUp
and Ctrl-PageDown
are available to focus previous/next tab by default.
if (gBrowser.treeStyleTab.tabbarShown) {
gBrowser.treeStyleTab.hideTabbar();
} else {
gBrowser.treeStyleTab.showTabbar();
}
gBrowser.treeStyleTab.removeTabSubtree(gBrowser.selectedTab);
TreeStyleTabService.getAncestorTabs(gBrowser.selectedTab).forEach(function(aTab) {
gBrowser.reloadTab(aTab);
});
var root = TreeStyleTabService.getRootTab(gBrowser.selectedTab);
var prev = TreeStyleTabService.getPreviousSiblingTab(root);
if (prev)
gBrowser.selectedTab = prev;
var root = TreeStyleTabService.getRootTab(gBrowser.selectedTab);
var next = TreeStyleTabService.getNextSiblingTab(root);
if (next)
gBrowser.selectedTab = next;
gBrowser.treeStyleTab.demoteCurrentTab();
gBrowser.treeStyleTab.promoteCurrentTab();
var tab = gBrowser.selectedTab, b = gBrowser.treeStyleTab.getTabBrowserFromChild(tab).treeStyleTab, next = b.getNextSiblingTab(tab);
if (next)
b.moveTabSubtreeTo(tab, (b.hasChildTabs(next) ? b.getLastChildTab(next) : next)._tPos);
var tab = gBrowser.selectedTab, b = gBrowser.treeStyleTab.getTabBrowserFromChild(tab).treeStyleTab, prev = b.getPreviousSiblingTab(tab);
if (prev)
b.moveTabSubtreeTo(tab, prev._tPos);