plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[EXP] Example repo that uses commands

Open ian opened this issue 1 year ago • 1 comments

What is the example you wish to see?

Have tried every which way to add commands to my project and nothing seems to work. It looks like the schema has support for it but nothing seems to bind in-app: https://github.com/PlasmoHQ/plasmo/blob/main/core/parcel-transformer-manifest/src/schema.ts#L146

Shouldn't it be as easy as adding commands to package.json manifest and then binding to them in background.ts?

package.json

"manifest": {
    "commands": {
      "open_side_panel_with_shortcut": {
        "suggested_key": {
          "mac": "MacCtrl+Shift+L",
          "windows": "Ctrl+Shift+L",
          "linux": "Ctrl+Shift+L"
        },
        "description": "Open Side Panel"
      }
    }
  }

background.ts

chrome.commands.onCommand.addListener((command) => {
  if (command === "open_side_panel_with_shortcut") {
    alert("open_side_panel_with_shortcut")
  }
})

Is it possible to expand out examples directory to include an example of how to use commands?

Is there any context that might help us understand?

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

ian avatar Sep 18 '24 14:09 ian

Why doesn't this work?

tonybruess avatar Jul 07 '25 18:07 tonybruess