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 {updateBadge} from '../utilities/badge.js';
|
||||
import {onCommandsHandler} from './commands.js';
|
||||
import {
|
||||
contextClicked,
|
||||
getContextMenus,
|
||||
|
@ -97,6 +98,8 @@ browser.contextMenus.onClicked.addListener(async (info, tab) => {
|
|||
await contextClicked(contextMenuIds, info, tab);
|
||||
});
|
||||
|
||||
browser.commands.onCommand.addListener(onCommandsHandler);
|
||||
|
||||
if (import.meta.env.VITE_BROWSER === 'chromium') {
|
||||
browser.action.onClicked.addListener(browserActionClicked);
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,15 @@ export default function createManifest(
|
|||
page: 'options/index.html',
|
||||
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 = {
|
||||
|
|
Loading…
Reference in New Issue