Opened on 09/20/2018 at 09:57:00 PM

Closed on 09/21/2018 at 12:20:34 PM

Last modified on 09/21/2018 at 05:01:57 PM

#6970 closed change (rejected)

Add commands section to manifest template and

Reported by: weissmar Assignee:
Priority: Unknown Milestone:
Module: Unknown Keywords:
Cc: BrentM, sebastian Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by weissmar)


We want to add the ability to add keyboard shortcuts to AdBlock for Chrome using the commands API ( In order to do this, a couple of changes need to be made to the build process, so that we can add something like the following to our metadata.adblock file:

toggle_pause = 

and then run the script and end up with the following in our manifest.json file:

  "commands": {
    "toggle_pause": {
      "description": "Toggle Pause/Resume on all sites", 
      "suggested_key": {
        "chromeos": "Ctrl+Shift+P", 
        "default": "Ctrl+Shift+P", 
        "linux": "Ctrl+Shift+P", 
        "mac": "Command+Shift+P", 
        "windows": "Ctrl+Shift+P"

What to change

We'd like to add the following to (in the buildtools repo) in the createManifest function:

    if metadata.has_section('commands'):
        commands = {}
        for key, values in metadata.items('commands'):
            if key == '':
            default, windows, mac, chromeos, linux, description = values.split()
            commands[key] = {
                'suggested_key': {
                    'default': default,
                    'windows': windows,
                    'mac': mac,
                    'chromeos': chromeos,
                    'linux': linux
                'description': description.replace('_', ' ')
        templateData['commands'] = commands

That code should go before the line that renders the template (manifest = template.render(templateData))

We'd also like to add the following to manifest.json.tmpl (in the templates folder of the buildtools repo):

  {%- if commands %}
  "commands": {{commands|json}},
  {%- endif %}

Attachments (0)

Change History (3)

comment:1 Changed on 09/20/2018 at 09:58:24 PM by weissmar

  • Description modified (diff)

comment:2 Changed on 09/21/2018 at 12:20:34 PM by sebastian

  • Cc sebastian added
  • Resolution set to rejected
  • Status changed from new to closed

You can already configure arbitrary manifest keys (see #6552). In the case here you would add folowing to the mainfest section in metadata.adblock:

commands.toggle_pause.description = Toggle Pause/Resume on all sites
commands.toggle_pause.suggested_key.chromeos = Ctrl+Shift+P
commands.toggle_pause.suggested_key.default = Ctrl+Shift+P
commands.toggle_pause.suggested_key.linux = Command+Shift+P
commands.toggle_pause.suggested_key.mac = Ctrl+Shift+P

comment:3 Changed on 09/21/2018 at 05:01:57 PM by weissmar

So you can -- thanks!

Add Comment

Modify Ticket

Change Properties
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none).
Note: See TracTickets for help on using tickets.