tbkeys icon indicating copy to clipboard operation
tbkeys copied to clipboard

Need a custom function that only close tab

Open leeyc0 opened this issue 4 years ago • 4 comments

I need a custom function that only close tab like https://addons.thunderbird.net/en-US/thunderbird/addon/close-on-escape-too/

I tried func:CloseTabOrWindow, but it terminates thunderbird itself too if there is no tab opening. I also tried tbkeys:closeMessageAndRefresh, although it does not terminate thunderbird, it has another side effect: expands all thread (which I don't want either).

What I need is tbkeys:closeMessageAndRefresh, but does not expand thread.

(Note: I am using tbkeys-lite therefore writing arbitrary function is not possible)

leeyc0 avatar Jan 14 '21 05:01 leeyc0

if (win.document.getElementById("tabmail").tabContainer.selectedIndex != 0) {
  win.CloseTabOrWindow();
}

This piece of code works exactly what I want. I'd like to be included in tbkeys-lite. I have to use tbkeys at the moment and set key binding as the code above.

leeyc0 avatar Jan 14 '21 05:01 leeyc0

Hey man, here is a quick fix in case you don't want to wait until it's implemented in the actual add on. Just go to your addons folder for your thunderbird profile, something like: .thunderbird/<RANDOM_CHARS>.default/extensions

In case you are comfortable with vim you can just edit the file in place with vi [email protected].

If not you need to unzip the .xpi file, modify the files, zip them again and then drag and drop into thunderbird add-ons window (which installs the addon). Make sure to remove the old one before you install the modified version. In a bash shell you can do the following:

  1. unzip [email protected] -d code
  2. cd code and edit implementation.js as described below
  3. zip -r ../new_version.zip *
  4. Go to thunderbird add-on page, remove the old add-on and install the new one by dragging and dropping the new_version.zip.

What you need to modify The code you posted is already part of the extension. You can find it in the implementation.js file. The problem is the line below that: win.goDoCommand("cmd_getMsgsForAuthAccounts"); Just comment out that line - looks like this for me: Screenshot_20210114_175711

Then reinstall the add-on and you should be good to go :)

Hope that helped :)

LasseWolter avatar Jan 14 '21 17:01 LasseWolter

I would close the current tab like so.

window.document.getElementById('tabmail').closeTab();

Reference...

http://searchfox.org/comm-esr78/search?q=closeTab.aOptional&regexp=true

morat523035 avatar Feb 03 '21 21:02 morat523035

Hey man, here is a quick fix in case you don't want to wait until it's implemented in the actual add on. Just go to your addons folder for your thunderbird profile, something like: .thunderbird/<RANDOM_CHARS>.default/extensions

In case you are comfortable with vim you can just edit the file in place with vi [email protected].

If not you need to unzip the .xpi file, modify the files, zip them again and then drag and drop into thunderbird add-ons window (which installs the addon). Make sure to remove the old one before you install the modified version. In a bash shell you can do the following:

1. `unzip [email protected] -d code`

2. `cd code` and edit implementation.js as described below

3. `zip -r ../new_version.zip *`

4. Go to thunderbird add-on page, remove the old add-on and install the new one by dragging and dropping the `new_version.zip`.

What you need to modify The code you posted is already part of the extension. You can find it in the implementation.js file. The problem is the line below that: win.goDoCommand("cmd_getMsgsForAuthAccounts"); Just comment out that line - looks like this for me: Screenshot_20210114_175711

Then reinstall the add-on and you should be good to go :)

Hope that helped :)

This should probably be on the README.md somewhere near "Common key bindings" as a way how to actually add custom bindings.

Thanks! It helped me to make several needed "Common key bindings" working =)

Snorch avatar Aug 05 '21 10:08 Snorch