Using the Chrome Commands API in Kiosk Mode

I am writing a kiosk mode chrome app that responds to a keyboard shortcut. The best way I've found to do this is Chrome commands

API
.

manifest.json

  {...,
    "kiosk_enabled": true,
    "kiosk_only": false,
    "commands": {
      "perform-foo": {
        "description": "Performs the Foo action",
        "suggested_key": {
          "default": "Ctrl+Shift+0"
        },
        "global": true
      }
    },
  ...}

      

As far as I can tell from the documentation, no special permissions are required. I made sure to use a "safe" keyboard shortcut according to the documentation, and figured I would point it out global

for that.

main.js

chrome.commands.onCommand.addListener(function(command) {
  if (command == 'perform-foo') {
    doFooFunction();
  }
}

      

This works on my Mac as an unpacked extension, but it doesn't work when run in single kiosk mode or normal kiosk mode on ChromeOS. I also wrote a test app that doesn't work in kiosk mode. When I test the keyboard shortcuts in chrome://extensions

, the apps seem to be successful, globally setting the correct keyboard shortcut.

Are API shortcuts commands

enabled for kiosk mode or for sharing with CrOS? What am I missing here?

+3


source to share


1 answer


From the documentation :

In desktop Chrome, commands can be globally scoped starting in version 35 and then work until Chrome has focus. NOTE. An exception is Chrome OS, where global commands are not currently allowed.



I've had success using kiosk mode commands on ChromeOS without a global option.

"commands": {
  "perform-foo": {
    "description": "Performs the Foo action",
    "suggested_key": {
      "default": "Ctrl+Shift+0"
    }
  }
},

      

+2


source







All Articles