Skip to content

Commit

Permalink
convert to custom command to chrome.onCommand events fire (_execute_a…
Browse files Browse the repository at this point in the history
…ction has limited API capabilities)
  • Loading branch information
BrodyHughes committed Jan 10, 2025
1 parent dca8a56 commit f6b3c4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/entries/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ popupMessenger.reply('rainbow_updateWagmiClient', async () => {
const { rainbowChains } = getRainbowChains();
updateWagmiConfig(rainbowChains);
});

chrome.commands.onCommand.addListener((command: string) => {
if (command === 'open_rainbow') {
chrome.action.openPopup();
// Now you can add your analytics here!
console.log('Opened via shortcut!');
}
});
4 changes: 2 additions & 2 deletions static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@
}
],
"commands": {
"_execute_action": {
"open_rainbow": {
"suggested_key": {
"windows": "Alt+Shift+R",
"mac": "Alt+Shift+R",
"chromeos": "Alt+Shift+R",
"linux": "Alt+Shift+R"
},
"description": "Open the Rainbow Wallet extension"
"description": "Shortcut to open Rainbow Wallet"
}
}
}

0 comments on commit f6b3c4c

Please sign in to comment.