Add a keyboard shortcut to toggle all redirects, default Alt+Shift+R.
This commit is contained in:
parent
6bd5bccd6f
commit
48a29eea71
|
@ -0,0 +1,7 @@
|
||||||
|
import {toggleAllRedirects} from '../utilities/toggle-all-redirects.js';
|
||||||
|
|
||||||
|
export async function onCommandsHandler(command: string): Promise<void> {
|
||||||
|
if (command === 'toggleAllRedirects') {
|
||||||
|
await toggleAllRedirects();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ import browser from 'webextension-polyfill';
|
||||||
|
|
||||||
import storage from '../redirect/storage.js';
|
import storage from '../redirect/storage.js';
|
||||||
import {updateBadge} from '../utilities/badge.js';
|
import {updateBadge} from '../utilities/badge.js';
|
||||||
|
import {onCommandsHandler} from './commands.js';
|
||||||
import {
|
import {
|
||||||
contextClicked,
|
contextClicked,
|
||||||
getContextMenus,
|
getContextMenus,
|
||||||
|
@ -97,6 +98,8 @@ browser.contextMenus.onClicked.addListener(async (info, tab) => {
|
||||||
await contextClicked(contextMenuIds, info, tab);
|
await contextClicked(contextMenuIds, info, tab);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
browser.commands.onCommand.addListener(onCommandsHandler);
|
||||||
|
|
||||||
if (import.meta.env.VITE_BROWSER === 'chromium') {
|
if (import.meta.env.VITE_BROWSER === 'chromium') {
|
||||||
browser.action.onClicked.addListener(browserActionClicked);
|
browser.action.onClicked.addListener(browserActionClicked);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,6 +12,15 @@ export default function createManifest(
|
||||||
page: 'options/index.html',
|
page: 'options/index.html',
|
||||||
open_in_tab: true,
|
open_in_tab: true,
|
||||||
},
|
},
|
||||||
|
commands: {
|
||||||
|
toggleAllRedirects: {
|
||||||
|
description:
|
||||||
|
"Toggle all redirects, this does the same as the extension icon's right-click option.",
|
||||||
|
suggested_key: {
|
||||||
|
default: 'Alt+Shift+R',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
|
|
Loading…
Reference in New Issue