Created
August 27, 2017 07:05
-
-
Save zbraniecki/000268ea27154bbccaad190dd479d226 to your computer and use it in GitHub Desktop.
selectTab extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browser.commands.onCommand.addListener(async (command) => { | |
let num = parseInt(command.substr(9, 10)) - 1; | |
let tabs = await browser.tabs.query({currentWindow: true}); | |
if (tabs.length < num) { | |
return; | |
} | |
browser.tabs.update(tabs[num].id, {active: true}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"applications": { | |
"gecko": { | |
"id": "[email protected]", | |
"strict_min_version": "48.0" | |
} | |
}, | |
"manifest_version": 2, | |
"name": "SelectTab Gnome Shortcut Override", | |
"version": "1.0", | |
"description": "An extension that overrides the default select-tab modifier key.", | |
"permissions": ["tabs"], | |
"background": { | |
"scripts": ["background.js"] | |
}, | |
"commands": { | |
"selectTab1": { | |
"suggested_key": { "default": "Ctrl+1" }, | |
"description": "Activate Tab 1" | |
}, | |
"selectTab2": { | |
"suggested_key": { "default": "Ctrl+2" }, | |
"description": "Activate Tab 2" | |
}, | |
"selectTab3": { | |
"suggested_key": { "default": "Ctrl+3" }, | |
"description": "Activate Tab 3" | |
}, | |
"selectTab4": { | |
"suggested_key": { "default": "Ctrl+4" }, | |
"description": "Activate Tab 4" | |
}, | |
"selectTab5": { | |
"suggested_key": { "default": "Ctrl+5" }, | |
"description": "Activate Tab 5" | |
}, | |
"selectTab6": { | |
"suggested_key": { "default": "Ctrl+6" }, | |
"description": "Activate Tab 6" | |
}, | |
"selectTab7": { | |
"suggested_key": { "default": "Ctrl+7" }, | |
"description": "Activate Tab 7" | |
}, | |
"selectTab8": { | |
"suggested_key": { "default": "Ctrl+8" }, | |
"description": "Activate Tab 8" | |
}, | |
"selectTab9": { | |
"suggested_key": { "default": "Ctrl+9" }, | |
"description": "Activate Tab 9" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ctrl+9
should activate the last tab instead of the 9th tab to match the behaviour ofAlt+9
.