george-thomas-hill / thunderkey

Thunderkey is a Thunderbird extension that lets you perform common email tasks using keyboard shortcuts.
Mozilla Public License 2.0
2 stars 1 forks source link

Current version is limited to 102.0, will stop working when 102.0.1 is released #2

Open jobisoft opened 2 years ago

jobisoft commented 2 years ago

Hi,

your extension passed a quick functionality test and seems to be compatible with Thunderbird 102, the next major version, which has been released this week.

However, the max version setting of 102.0 is limiting this add-on to Thunderbird 102.0 and your users will not be able to use it, when Thunderbird 102.0.1 has been released.

If you also find, that your add-on is working as expected in Thunderbird 102, please submit a new version with a max setting of 102.* (changing the value on ATN only will prevent offline installs, which do not check the updated max version setting on ATN)

If you find errors which we missed, feel free to reach out for help: https://developer.thunderbird.net/add-ons/community

jobisoft commented 2 years ago

If you run into issues, which prevent your add-on to run properly in Thunderbird 102, I would like to offer my help to hunt them down!

george-thomas-hill commented 2 years ago

@jobisoft

It's very kind of you to offer to help.

When I tried Thunderkey using Thunderbird 102, I found that it didn't behave correctly.

Some functionality worked fine: when I used Thunderkey to scroll a message (by pressing the control key and arrow keys), the message scrolled without any problems.

But when I used my shortcuts to move mail to a new folder, it moved the mail to the folder—but it also performed other native Thunderbird actions that, I believe, were triggered by those shortcuts.

For example, I wanted to use alt-L (or perhaps ctrl-L) to move mail to a "letters" folder, but those key combinations triggered other behavior, too, and made Thunderbird menu bar sections open and close.

I think that the problem is that Thunderkey uses an experiment to get keydown events.

It doesn't use the WebExtensions commands API.

Right now, I don't think that I can take the time to switch Thunderkey over to the commands API.

Unless the situation changes, this means that Thunderkey may have, unfortunately, reached the end of its life.

jobisoft commented 2 years ago

I see two approaches:

  1. Commands API:

    It does look like you are almost there. The commands API is not dynamic, so you need to define placeholders for your key combinations. It appears that this will be annoying, but basically just a copy-paste-job. You have 6 main commands, 20 custom folder select commands and 20 custom folder move commands. So that will be 46 entries in your manifest, like so:

"commands": {
  "scroll_message_up": {
    "suggested_key": {
      "default": "Ctrl+Left"
    },
    "description": "ThunderKey: Scroll the current message up"
  },
  "scroll_message_up": {
    "suggested_key": {
      "default": "Ctrl+Right"
    },
    "description": "ThunderKey: Scroll the current message down"
  },
...
  "select_folder_20": {
    "description": "ThunderKey: Select folder #20"
  },
  "move_to_folder_20": {
    "description": "ThunderKey: Move current message to folder #20"
  },

}

The documentation says the suggested_key entry is optional, so you do not need to define dummy keys for the folder keys.

Your options UI no longer has to define which key is associated with a command, all it has to edit is each commands enable/disable state and for the folder commands, which folder is connected to which placeholder. The actual shortcut is set by the user in the shortcuts UI of Thunderbird.

  1. PreventDefault()

Your Experiment is using shortcuts which are also used by Thunderbird. To override TB, you have to add

        event.preventDefault();
        event.stopImmediatePropagation();
        event.stopPropagation();

to your Experiment, before this line:

 keydownWindowListener.emit("keypress", keyCombination, path);

However, the way you have crafted your Experiment, this will disable ALL key shortcuts in TB, which involve Shift, Ctrl, Alt, ... To be selective here and only disable shortcuts actually used by your extension, the handleEvent() function needs to know which key shortcuts are enabled. You cannot ask your background/localStorage because this will require an async function call which will jump out of the execution flow and the event will propagate. What you could do:

Add a method to your Experiment, which you call from your background, each time the user changes a key combination. You do not need to send, what that key combination does, the Experiment just needs to know the current set of enabled keys, which it can store in a local var. You also have to send the enabled key set on add-on load.

I would suggest the Commands API. We also updated the folders API to return a properly sorted folder list, so your other Experiment usage might be not needed as well anymore - and you could turn your add-on into a pure WebExtension.

Tell me if I can be of further help.

george-thomas-hill commented 2 years ago

@jobisoft

Thank you for the thoughtful reply.

I agree that one of those two approaches would be necessary to get Thunderkey to work with Thunderbird 102.0.1 and later.

However, right now, I'm not going to be able to find the time to implement and troubleshoot a fix.

I"ll post again if my circumstances change.

Thank you.

reagle commented 1 year ago

Perhaps you should change the version number that this is supposed to work with in the repository?