How to "Manage Extension Shortcuts"?

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
voipfc
Posts: 75
Joined: November 16th, 2006, 11:16 am
Location: Accra

How to "Manage Extension Shortcuts"?

Post by voipfc »

Hi guys,

I am trying to switch to a keyboard driven totally mouseless workflow (wherever possible) and one area I am frustrated is in managing keyboard shortcuts. After seeing how Firefox now has a "Manage Extension Shortcuts" page in about:preferences I want to create something like for myself, something more effective, else I will have to modify every addon I use to read my customized settings.

I have asked some questions at Github I have linked to rather than repeat them here.


https://github.com/mstriemer/html-about ... -451199913

https://github.com/passff/passff/pull/3 ... -498034693

https://discourse.mozilla.org/t/what-ar ... s/41047/11

To summarise the questions are:

1. Where is the Manage Extensions Shortcuts implemented in the Firefox code base?

2. Where is the data for the shortcuts stored?

3. Is it possible for an addon to read all the shortcuts including those different from the manifest.json and those modified by the users?

4. Is it possible to for addon to set the shortcuts for other addons?

5. Are there Webextensions APIs for the whole process, ie those exposed to addon developers, not those used internally by Firefox
User avatar
DanRaisch
Moderator
Posts: 127224
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: How to "Manage Extension Shortcuts"?

Post by DanRaisch »

Moving to Firefox Builds where pre-release versions are discussed.
voipfc
Posts: 75
Joined: November 16th, 2006, 11:16 am
Location: Accra

Re: How to "Manage Extension Shortcuts"?

Post by voipfc »

DanRaisch wrote:Moving to Firefox Builds where pre-release versions are discussed.
I think this belongs in Extension development because "Manage Extension Shortcuts" is the current stable version.
User avatar
DanRaisch
Moderator
Posts: 127224
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: How to "Manage Extension Shortcuts"?

Post by DanRaisch »

I don't see that in version 67.0 which is current. What is the complete menu path you are using to get to that?
User avatar
mightyglydd
Posts: 9813
Joined: November 4th, 2006, 7:07 pm
Location: Hollywood Ca.

Re: How to "Manage Extension Shortcuts"?

Post by mightyglydd »

Click on the cogwheel to the right of Extensions > Manage Your Extensions
#KeepFightingMichael and Alex.
voipfc
Posts: 75
Joined: November 16th, 2006, 11:16 am
Location: Accra

Re: How to "Manage Extension Shortcuts"?

Post by voipfc »

Exactly as @mightyglydd says
User avatar
DanRaisch
Moderator
Posts: 127224
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: How to "Manage Extension Shortcuts"?

Post by DanRaisch »

Yup, there it is. OK, moving back to Extension Releases. (Although I'm thinking that Support would be more appropriate.)
morat
Posts: 6421
Joined: February 3rd, 2009, 6:29 pm

Re: How to "Manage Extension Shortcuts"?

Post by morat »

1.

chrome\toolkit\content\mozapps\extensions\shortcuts.html
chrome\toolkit\content\mozapps\extensions\shortcuts.js

These files are in the omni.ja archive in the install directory.

4.

Addons are explicitly blocked from operating on another addon's moz-extension page.

How can I execute a userscript on a moz-extension page?
http://stackoverflow.com/questions/52131490

5.

commands
http://developer.mozilla.org/docs/Mozil ... n/commands
http://developer.mozilla.org/docs/Mozil ... I/commands

P.S.

Here is how to list shortcuts using the browser toolbox console.

Code: Select all

(function () {

  AddonManager.getAddonsByTypes(["extension"]).then(function (addons) {
    addons.forEach(function (addon) {
      var policy = WebExtensionPolicy.getByID(addon.id);
      if (policy && policy.extension && policy.extension.shortcuts) {
        console.log(addon.name);
        policy.extension.shortcuts.allCommands().then(function (commands) {
          for (var i = 0; i < commands.length; i++) {
            var command = commands[i];
            console.log(command);
          }
        });
      }
    });
  });

})();
Here is how to update a shortcut using the browser toolbox console.

Code: Select all

(function () {

  var id = "uBlock0@raymondhill.net"; // uBlock Origin
  var policy = WebExtensionPolicy.getByID(id);
  if (policy && policy.extension && policy.extension.shortcuts) {
    policy.extension.shortcuts.updateCommand({
      name: "launch-element-picker",
      shortcut: "Ctrl+Shift+1",
    });
  }

})();
Firefox 67.0.1
Windows 7 SP1 32-bit
Post Reply