Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a custom function that only close tab #63

Open
leeyc0 opened this issue Jan 14, 2021 · 4 comments
Open

Need a custom function that only close tab #63

leeyc0 opened this issue Jan 14, 2021 · 4 comments

Comments

@leeyc0
Copy link

leeyc0 commented Jan 14, 2021

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
Copy link
Author

leeyc0 commented Jan 14, 2021

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.

@LasseWolter
Copy link

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 tbkeys-lite@addons.thunderbird.net.xpi.

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 tbkeys-lite@addons.thunderbird.net.xpi -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 :)

@morat523035
Copy link

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

@Snorch
Copy link

Snorch commented Aug 5, 2021

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 tbkeys-lite@addons.thunderbird.net.xpi.

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 tbkeys-lite@addons.thunderbird.net.xpi -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 =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants