Vitaly Zdanevich
Vitaly Zdanevich

Reputation: 14886

"commands" (shortcuts): is it possible to sort them for `chrome://extensions/shortcuts`?

In my manifest.json I have:

  "commands": {
    "add": {
        "suggested_key": {
            "default": "MacCtrl+Shift+A"
        },
        "description": "__MSG_addToFeed__"
    },
    "playPause": {
        "suggested_key": {
            "default": "Alt+P"
        },
        "description": "__MSG_playPause__"
    },
    "nextArticle": {
        "description": "__MSG_nextArticle__"
    },
    "nextChunk": {
        "suggested_key": {
            "default": "Alt+N"
        },
        "description": "__MSG_nextChunk__"
    },
    "prevArticle": {
        "suggested_key": {
            "default": "Alt+B"
        },
        "description": "__MSG_prevArticle__"
    }
  }

This is what I get on chrome://extensions/shortcuts chromium 72 shortcuts

I do not understand how they are sorted - neither by title nor by shortcut. And looks like no way to change that order.

Documentation links: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands

https://developer.chrome.com/extensions/commands

Related source code of Chromium: https://github.com/chromium/chromium/blob/2ca8c5037021c9d2ecc00b787d58a31ed8fc8bcb/chrome/browser/resources/md_extensions/keyboard_shortcuts.js

Upvotes: 0

Views: 61

Answers (1)

herodrigues
herodrigues

Reputation: 967

Add numbers to your commands object as they are sorted by their keys.

 "commands": {
    "1_add": { ... },
    "2_playPause": { ... },
    "3_nextArticle": { ... },
    "4_nextChunk": { ... },
    "5_prevArticle": { ... }
  }

Upvotes: 0

Related Questions