Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Detect user's keyboard shortcut in a chrome extension

I am currently developing a chrome extension. Only, here I am confronted with a problem: I would like my extension to detect when the user performs a keyboard shortcut and that triggers a JS function. For that, my manifest.json file looks like this:

{
  "manifest_version": 3,
  "name": "name",
  "version": "1.0.0",

  "description": "description.",
  "icons":{
    "16": "img/logo16.png",
    "48": "img/logo48.png",
    "128": "img/logo128.png"
  },

  "permissions": [
    "storage",
    "activeTab",
    "scripting"
  ],
  "background": {
    "service_worker": "js/background.js"
  },
  "commands": {
    "Restart App": {
      "suggested_key": {
        "default": "Ctrl+Shift+6",
        "mac": "Command+Shift+6"
      },
      "description": "Restart my app (Debugging)"
    }
  }
}

My background.js file located in the js folder, contains this:

chrome.commands.onCommand.addListener(function (command)
{
    if (command == "Restart App")
    {
        chrome.runtime.reload();
    };
    alert('app restart success !');
});

Only, when I launch the extension and execute the keyboard shortcut, nothing happens, no error is reported.

Would you have any ideas, thank you in advance.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!