Reputation: 98
I'm coding a Firefox extension that allows user to use shortcuts on Spotify Web Player and I want them configurable.
The first approach is this example using options page
However, how can I load the customized shortcuts on the manifest.json?
Link to my repository extension
Thank you in advance.
Upvotes: 1
Views: 161
Reputation: 2568
Currently, there is no such functionality for user's defining shortcuts in Firefox as you can see here. In the future, maybe this resolved.
Currently, you can play with a work around:
You have to catch the keypress events. The background script is usually not open to catch key presses.
To catch keypresses on web pages, you will have to use a content script that sends messages to the background script. The content script is injected to the open web page and insert methods for catching keypresses, and then send a message to the background script with information on which keys are pressed.
Then the background script will send another message to the script responsible this executing the command.
Disclaimer: I have no tested, so proceed with caution.
Upvotes: 2