dorando-keyconfig icon indicating copy to clipboard operation
dorando-keyconfig copied to clipboard

Thunderbird 68 support

Open tasn opened this issue 5 years ago • 38 comments

Please add support for Thunderbird 68. I can't use thunderbird without this extension!!! :)

Thanks!

tasn avatar Sep 11 '19 11:09 tasn

I tried and failed a few months ago. :-)

It's not impossible, it's just that I didn't have the knowledge and experience necessary to accomplish it at the time and didn't have time to learn it.

I'm hoping someone else will step up to help, but so far no one has.

In the meantime, you can use my userChromeJS add-on to run JavaScript which modifies key bindings, though that's obviously not as user-friendly as keyconfig.

Here's some sample code from my own userChrome.js file:

function userChromeUnbindKey(keyset_id, key_id) {
    var keyset = document.getElementById(keyset_id);
    if (! keyset) {
        console.log("Could not find keyset " + keyset_id);
        return;
    }
    var key = document.getElementById(key_id);
    if (! key) {
        console.log("Could not find key " + key_id);
        return;
    }
    keyset.removeChild(key);
}

function userChromeBindKey(keyset_id, key, key_id, modifiers, command, observes) {
    var keyset = document.getElementById(keyset_id);
    if (! keyset) {
        console.log("Could not find keyset " + keyset_id);
        return;
    }
    var elt = document.createXULElement("key");
    if (key)
        elt.setAttribute("key", key);
    if (key_id)
        elt.setAttribute("key_id", key);
    if (modifiers)
        elt.setAttribute("modifiers", modifiers);
    if (command)
        elt.setAttribute("oncommand", command);
    if (observes)
        elt.setAttribute("observes", observes);
    keyset.appendChild(elt);
}

I use this, e.g., to bind Alt-S in the main Thunderbird window to a custom function I wrote:

if (location == "chrome://messenger/content/messenger.xul")
    userChromeBindKey("mailKeys", "s", "key_to_spamcop", "alt",
                      "jikMoveSpam();");

jikamens avatar Sep 11 '19 11:09 jikamens

Ah, thanks! I'll try to play with it and see if I can manage. :)

tasn avatar Sep 11 '19 15:09 tasn

I came here to ask if there were plans to port keyconfig to Thunderbird 68 as well. I tried a bit to get keyconfig working in Thunderbird 68 myself but got stuck trying to get keyconfig-service.js to load.

I decided it was quicker to start over from scratch and build back up, testing that each part worked rather than try to reverse engineer which parts of keyconfig no longer worked and what had to change to make them work again. The addon I ended up with is https://github.com/willsALMANJ/tbkeys. It has my preferred bindings hard-coded into it and does not provide for customization, but others could take it and edit in their own bindings.

If no one figures out how to port keyconfig to Thunderbird 68, I could add a UI like keyconfig's for assigning keys to javascript snippets to my extension, so it could be used more easily by others, but for now I will wait to see anyone is able to get keyconfig itself working.

wshanks avatar Sep 11 '19 19:09 wshanks

@willsALMANJ, thanks a lot, I also want it for the same keybindings (vim-like).

How do I build the extension? I couldn't find any resources online. Thanks!

Edit: and I tried just zipping the add-on folder, but while it installed, it didn't work.

tasn avatar Sep 11 '19 20:09 tasn

@tasn Zip everything inside the addon folder (i.e. there should be no addon/ folder inside the zip archive; manifest.json, etc. should be the top level) and save it as a file ending in .xpi. Then use "Install Add-on from File.." in the Add-ons Manager.

wshanks avatar Sep 12 '19 04:09 wshanks

That's exactly what I did, it doesn't work. It correctly installs the addon, but doesn't actually bind the keys. However, if I go to "Debug addons -> temporary install" and install by choosing the manifest file, it works (though only until I restart thunderbird). Weird.

tasn avatar Sep 12 '19 07:09 tasn

@willsALMANJ: your plugin has an issue: hitting "r" and etc in the search box also triggers the keybindings. Do you get that as well, or is something completely crazy here?

tasn avatar Sep 12 '19 14:09 tasn

@tasn We should move discussion of the plugin to an issue in its repo, so this issue can stay dedicated to Thunderbird 68 support for keyconfig. I created an issue for the behavior you described.

wshanks avatar Sep 12 '19 15:09 wshanks

Here is a Dorando keyconfig version that supposedly works with Firefox 68.

http://forums.mozillazine.org/viewtopic.php?p=14845317#p14845317

morat523035 avatar Sep 23 '19 13:09 morat523035

Something to be aware of: Thunderbird is dropping support of traditional add-ons completely with the next release. So trying to get something working beyond the userChrome.js workaround or the little extension I made might not be worth the effort.

wshanks avatar Oct 12 '19 04:10 wshanks

:(

Your little extension will continue working though?

tasn avatar Oct 12 '19 09:10 tasn

No, my extension is a legacy extension as well. We need to look into what the Thunderbird developers are willing to add to MailExtensions for a keyboard shortcut API.

wshanks avatar Oct 15 '19 18:10 wshanks

i really miss this addon on thunderbird =((

ftoledo avatar Oct 18 '19 16:10 ftoledo

I tried not using it for a few days, and it was hell. @willsALMANJ saved the day, but apparently only temporarily. :(

I won't just miss it. I need it!

tasn avatar Oct 19 '19 07:10 tasn

yeah @tasn thw @willsALMANJ extension work for me.. I just need only three shorcuts that save my life ([R]reply [A] Reply to all and [F]forward

=) i hope that dorando-keyconfig can be ported to TB 68+

Saludos!

ftoledo avatar Oct 21 '19 03:10 ftoledo

Could you please explain again for a n00b, how to make the addon work in Thunderbird 68?

rubo77 avatar Nov 11 '19 12:11 rubo77

Could you please explain again for a n00b, how to make the addon work in Thunderbird 68?

You must download or clone the source code , the put in into the extension directory at you profile

ftoledo avatar Nov 11 '19 13:11 ftoledo

I tried cloning this repo, and used tar:

git clone https://github.com/trlkly/dorando-keyconfig
cd dorando-keyconfig/
tar cvzf ../dorando-keyconfig.xpi *

then install this addon as file in thunderbird 68.1.2

but still blocked there: "... not compatible"

rubo77 avatar Nov 11 '19 14:11 rubo77

hi @rubo77 You must zip the "addon" directory, not from the root directory of your clone Saludos!

ftoledo avatar Nov 11 '19 14:11 ftoledo

@tasn Zip everything inside the addon folder (i.e. there should be no addon/ folder inside the zip archive; manifest.json, etc. should be the top level) and save it as a file ending in .xpi. Then use "Install Add-on from File.." in the Add-ons Manager.

thats what I did

rubo77 avatar Nov 11 '19 16:11 rubo77

can someone please create such a working xpi archive and link it here?

rubo77 avatar Nov 11 '19 16:11 rubo77

@rubo77 As far as I know, no one has gotten this add-on to work in Thunderbird 68. There was a link above about a version that worked in Firefox 68, but it wasn't clear that that really worked. There are workarounds like the userchromJS and tbkeys options linked to above. To get keyconfig to work in Thunderbird 68 would take more development time to debug which parts of the XUL API had been broken and find workarounds (without much documentation since XUL has been deprecated by Mozilla). Also, there is not much payoff to putting time into that debugging -- Thunderbird has announced that support for XUL addons like keyconfig will not be supported in the next release.

wshanks avatar Nov 13 '19 04:11 wshanks

For folks trying to use @jikamens userChromeJS stopgap to unbind default shortcuts (say, to free them up for the venerable Archive This), you may be wondering where to find key_id.

  • Find the name of the command here. You may find it easiest to search for "p", for example, to find what's currently assigned to the p key on your keyboard. In this example, you'll find:

    <!ENTITY prevUnreadMsgCmd.key "p">
    

    In this case, the name of the command is prevUnreadMsgCmd.

  • Now find that command here and take note of its id. For example:

    <key id="key_previousUnreadMsg" key="&prevUnreadMsgCmd.key;"       oncommand="goDoCommand('cmd_previousUnreadMsg')"/>
    

    This yields key_previousUnreadMsg which is the key_id we need for the userChromeUnbindKey function.

rossmeissl avatar Jan 21 '20 15:01 rossmeissl

any update for the 68+ support? i really miss this extension =( using ctrl+L to forward emails sucks! jjaja!

ftoledo avatar Jan 24 '20 14:01 ftoledo

For the unbinding issue @rossmeissl mentioned above: I had the same issue for the 'r' key which I wanted to rebind. I did it by:

function RemoveBindings(kset, key) {
	var keyset = document.getElementById(kset);
	if (!keyset) {
		console.log("Could not find keyset " + keyset_id);
		return;
	}
	for (var e of keyset.children) {
		var k = e.getAttribute("key");
		if (k == key) {
			console.log("Remove binding "+e.id+" for key "+k);
			keyset.removeChild(e);
		}
	}
}

in my userChrome.js, and then RemoveBindings("mailKeys", "r") before binding 'r' with various modifiers. This simply removes all existing bindings.

romanho avatar Jan 24 '20 15:01 romanho

I'm just an ordinary user, so my apologies if my comments on this forum are out of line. I have a simple observation. The growing pains Thunderbird is going through right now seem to be similar to what Firefox went through not long ago. I'm guessing the code might be similar. There is a developer on the Firefox side that has a shortcut add-on (https://github.com/mikecrittenden/shortkeys) that works in current version of Firefox. If the code was indeed similar, I was wondering if he could be of some help.

fefabfee avatar Jan 26 '20 14:01 fefabfee

I'm thinking about updating TB to the latest version. I just want to change 2 keys: R for reply and N for new mail compose. How do I make that happen in the userChromeJS add-on?

koolx avatar Mar 08 '20 20:03 koolx

@fefabfee Unfortunately, Firefox add-ons do not translate to Thunderbird very well right now. One problem is that Firefox add-ons add a lot their user facing components (like key event listeners) through content scripts that get loaded into the current web page. This works well because in Firefox the web page is almost the entire UI. In Thunderbird, most of the UI is various elements controlled by Thunderbird. I see on Thunderbird's roadmap one item is to replace current UI with a web-based UI. Perhaps when that is done add-ons will be able to inject content scripts into the main UI that can interact with the whole UI.

wshanks avatar Mar 09 '20 03:03 wshanks

For the unbinding issue @rossmeissl mentioned above: I had the same issue for the 'r' key which I wanted to rebind. I did it by:

function RemoveBindings(kset, key) {
	var keyset = document.getElementById(kset);
	if (!keyset) {
		console.log("Could not find keyset " + keyset_id);
		return;
	}
	for (var e of keyset.children) {
		var k = e.getAttribute("key");
		if (k == key) {
			console.log("Remove binding "+e.id+" for key "+k);
			keyset.removeChild(e);
		}
	}
}

in my userChrome.js, and then RemoveBindings("mailKeys", "r") before binding 'r' with various modifiers. This simply removes all existing bindings.

Just so great! Been finally able to disable some key bidings which are quite bothering for me; at least till version 78.

sespadam avatar May 04 '20 14:05 sespadam

Plaease bring keyconfig back to life! Thunderbird 68 users are awaiting with confidence.

10,000$ for brave programmers.

michele-bs avatar Jul 16 '20 10:07 michele-bs