Add commands API bind, <C-,> for escapehatch

This commit is contained in:
Oliver Blanthorn 2020-07-04 18:43:09 +01:00
parent 64e8b3033e
commit a54e7cde95
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
3 changed files with 18 additions and 1 deletions

View file

@ -244,6 +244,11 @@ omnibox.init()
// }}}
browser.commands.onCommand.addListener((command_name: string) => {
if (command_name !== "escape_hatch") return
excmds_background.escapehatch()
})
// {{{ Obey Mozilla's orders https://github.com/tridactyl/tridactyl/issues/1800
native.unfixamo()

View file

@ -2936,6 +2936,10 @@ export async function shellescape(...quoteme: string[]) {
* Magic escape hatch: return to a tab in the current window where Tridactyl can run, making such a tab if it doesn't currently exist.
*
* Only useful if called from a background context, e.g. at the end of an RC file to ensure that when you start the browser you don't get trapped on an about: page.
*
* By default, bound to `<C-,>` via the commands API which may be changed via about:addons, the cog icon in the top right, then "Manage Extension Shortcuts"
*
* <!-- TODO: add `bind --mode=mozilla` to rebind this + remove the special casing in background.ts -->
*/
//#background
export async function escapehatch() {

View file

@ -15,6 +15,14 @@
"chrome_url_overrides": {
"newtab": "static/newtab.html"
},
"commands": {
"escape_hatch": {
"suggested_key": {
"default": "Ctrl+Comma"
},
"description": "Focus or create a tab in which Tridactyl can run"
}
},
"content_scripts": [
{
"matches": [