Search code examples
javascriptgoogle-chromegoogle-chrome-extension

Open Chrome Extension popup with a keyboard shortcut?


I know we cannot open chrome extension popup directly from background javascript. But is there a way that the popup opens when a user presses some key combination ?


Solution

  • The chrome.commands api enables the user to bind hotkeys that will trigger commands such as opening the browser action.

    Example : https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/_archive/mv2/api/commands (Press Ctrl+Shift+F (Command+Shift+F on a Mac) to open the browser action popup, press Ctrl+Shift+Y to send an event (Command+Shift+Y on a Mac))