2

Chrome extension noob here, I'm trying to write a manifest.json for an extension so that the extension's popup (hotbox.html) launches while hitting the Command+Shift+0 on my keyboard.

I have the following code, however, it does nothing when I try to use my supposed shortcut. I have verified that the shortcut does not conflict with any other that I know of, I've also tried installing and uninstalling the extensions, but it doesn't work.

I am also getting no error messages. Any ideas? Chrome Version 68.0.3440.106

{
    "manifest_version": 2,

    "name": "Composure",
    "description": "Test Extension",
    "version": "2.13.2",

    "browser_action": {
        "default_icon": "content/img/logo.png",
        "default_popup": "content/hotbox.html"
    },

    "background": {
        "scripts": ["content/hotbox.js"],
        "persistent": false
    },

    "commands": {
        "_execute_browser_action": {
            "suggested_key": {
                "mac": "Command+Shift+0"
            }
        },

        "_execute_page_action": {
            "suggested_key": {
                "mac": "Command+Shift+1"
            }
        }
    }
}
hong4rc
  • 3,999
  • 4
  • 21
  • 40
K. Green
  • 73
  • 1
  • 1
  • 3
  • I figured it out. I changed the Shortcut to Command+Shift+1 and removed the "_execute_page_action", uninstall and reinstall and it works now. Wish this could somehow work with just the "Spacebar" – K. Green Sep 04 '18 at 02:56
  • those keyboard shortcuts must start with `` or `` modifier keys... hard to believe one would wish to run a script whenever pressing ``; just count the blanks in between the words. – Martin Zeitler Sep 04 '18 at 04:27
  • It makes sense to use the space bar depending on the site where you run the extension, specially if the primary purpose of the page is not related to typing words. – K. Green Sep 05 '18 at 04:11
  • You could listen for Space using the the `window.addEventListener()` api, since I presume the window will be open when you need to be notified that the user pressed "Space". – Lincoln May 22 '20 at 09:50

1 Answers1

-1

Just remove the "_execute_page_action": & reinstall. That should work.

General Grievance
  • 4,555
  • 31
  • 31
  • 45