User Help for Mozilla Thunderbird
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted September 5th, 2014, 2:36 am
Dear friends, I'd like to set up a hotkey for the "Show remote content" command, so that when I open a Message I can quickly active the remote images and so on (but only when and if I want). I already use with satisfaction the Exceptions in the list of the addresses from which to regularly show the remote content, but here I am referring to e-mails from occasional addresses, not saved in my Address Book. And I still want that the default behavior is not to show them; only if I wish, and with a hotkey. I mean, maybe using the Keyconfig addon, for example. But I need to know how to express the command in terms of CODE:  Thanks!
DanRaisch
Moderator

Posts: 124435Joined: September 23rd, 2004, 8:57 pmLocation: Somewhere on the right coast
Posted September 5th, 2014, 4:24 am
Moving to Thunderbird Support.
morat
Posts: 4334Joined: February 3rd, 2009, 6:29 pm
Posted September 5th, 2014, 5:45 am
Try this: * toggle "Show remote content for this message" - Code: Select all
var kNoRemoteContentPolicy = 0; var kBlockRemoteContent = 1; var kAllowRemoteContent = 2; var msgHdr = gMessageDisplay.displayedMessage; if (msgHdr) { var remoteContentPolicy = msgHdr.getUint32Property("remoteContentPolicy"); if (remoteContentPolicy == kBlockRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kAllowRemoteContent); } else if (remoteContentPolicy == kAllowRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kNoRemoteContentPolicy); } window.content.focus(); }
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted September 5th, 2014, 2:44 pm
Thank you morat for the suggestion. But, unfortunately, I can't apply it properly, and maybe I made a mistake somewhere.
Now all the messages show remote content by default, even if in the general Options I unchecked the related box.
So maybe I modified, using your command, somewhat in the "deep" configuration of the variables.
How to reset to fabric values, in order to try alternatives or make other attempts?
***
Isn't there a method to edit the Thunderbird general hotkeys without keyconfig? In fact, I currently hardly understand how it works precisely.
Again thanks.
morat
Posts: 4334Joined: February 3rd, 2009, 6:29 pm
Posted September 5th, 2014, 7:01 pm
Do you know how to create a keyboard shortcut with the keyconfig extension? I can post instructions if you want. The code changes the remoteContentPolicy property in the mail summary file (*.msf) for the selected message. It does not change "all the messages".  What version of Thunderbird are you using? I am assuming you are using the release build.
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted September 7th, 2014, 10:42 am
Thank you morat, very kind from you this help. Your right, some other instructions about Keyconfig will be useful. In fact, maybe I'm not so expert in creating a shortcut with Keyconfig. For example, I can't understand so well: - The meaning of the checkbox "Global";
- When I want to add a new shortkey, in the upper part of the window I find listed all the other windows currently opened: what to select?;

morat
Posts: 4334Joined: February 3rd, 2009, 6:29 pm
Posted September 7th, 2014, 9:56 pm
Instructions: 1. install extension and restart http://mozilla.dorando.at/keyconfig.xpi 2. tools > keyconfig 3. select a window in the dropdown window list 4. add a new key 5. type a command in the /* CODE */ box, e.g. alert("test"); 6. type a shortcut in the <Disabled> box, e.g. Ctrl+Shift+! 7. apply 8. close The shortcuts are stored as preferences. You can use the search bar at the top of the about:config window to filter the preferences that you want to reset. Search: keyconfig.main. You can also reset the shortcuts in the keyconfig dialog. You need to restart after resetting shortcuts. http://forums.mozillazine.org/viewtopic.php?f=48&t=72994Michele_BS wrote:meaning of the checkbox "Global"
Here are two examples that alert the chrome url when using the shortcut. Example 1) Create a ctrl+shift+1 shortcut with the global option checked. - Code: Select all
Services.prompt.alert(null, "Example 1", document.location.href);
Example 2) Create a ctrl+shift+2 shortcut with the global option unchecked. - Code: Select all
Services.prompt.alert(null, "Example 2", document.location.href);
Example 1 works in all windows. Example 2 works in only the selected window. Here is a list of common chrome urls. 3pane window > chrome://messenger/content/messenger.xul message window > chrome://messenger/content/messageWindow.xul compose window > chrome://messenger/content/messengercompose/messengercompose.xul address book window > chrome://messenger/content/addressbook/addressbook.xul keyconfig window > chrome://keyconfig/content/keyconfig.xul prompt window > chrome://global/content/commonDialog.xul Michele_BS wrote:When I want to add a new shortkey, in the upper part of the window I find listed all the other windows currently opened: what to select?
 The 1st window in the dropdown list is the 3pane window. The 2nd window in the dropdown list is likely the message window. The 3rd window in the dropdown list is the keyconfig window. You should select the window you want the shortcut to work in.
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted September 9th, 2014, 4:54 pm
Morat, your instructions were clear. I learned and applied: all works perfectly, now, exactly as I desired! I set up "C" as shortcut with your code, checking "Global". Now if I press "C" in a "clouded" message, the images and other remote content appear. And if I press "C" again, instead, the content turns off as it originally was. Great help from you: thanks. *** But, I wonder, is there any way to switch this toggle "active/inactive" from the menu? I can't find this command anyway.
morat
Posts: 4334Joined: February 3rd, 2009, 6:29 pm
Posted September 9th, 2014, 8:18 pm
You're welcome. Michele_BS wrote:any way to switch this... from the menu?
There is no standard way to undo the "Show remote content in this message" command. viewtopic.php?p=13739663#p13739663
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted September 13th, 2014, 4:52 pm
...how delightful to press "C" and "C" again a lot of times, and to see the remote content appearing and disappearing all the times I want... It's beautiful to feel all this mastery with the software. Gratifying. *** p.s. "C" is the shortcut I chose
screennam
Posts: 1Joined: August 12th, 2010, 12:17 pm
Posted March 6th, 2015, 10:47 am
Sorry for my newbie question but how do you install this to Thunderbird?
LIMPET235
Moderator

Posts: 39417Joined: October 19th, 2007, 1:53 amLocation: The South Coast of N.S.W. Oz.
Posted March 6th, 2015, 10:54 am
Hi, Right click & Save Link as....to wherever you desire. Then drag 'n' drop the .xpi file into Thunderbird's Addons screen. Close & re-open to complete.
(I'm leaving this open, even though it's rather old.)
Ancient Amateur AstronomerWin-7-HP/Intel® DualCore-2.0GHz/500G HDD/4 Gig Ram/550Watt PSU/350WattUPS/Firefox-20.0-62.0-70.0-79.0/T-bird-2.0.0.24/SnagIt-v10.0.1/MWP-7.12. W.M.Y.C.( Always choose the "Custom" Install.)
MicheleBS
Posts: 85Joined: May 11th, 2012, 11:14 am
Posted July 18th, 2020, 3:18 pm
Dear users, unluckily, dorando keyconfig isn't supported anymore (Thunderbird 68+). On the keyconfig forum, It was suggested to me to try tbkeys as an alternative to keyconfig. So I am trying to create again, here in tbkeys, a hotkey to toggle hide/view the remote content in my messages (this is so useful, for me!). But I don't know if the keyconfig code that morat provided me several years ago, just here in this thread, can be applied also to tbkeys. Tbkeys is based on a little textfile (with json syntax, I think) where all the hotkeys are listed. Here is, for example, the custom ones: - Code: Select all
{ "j": "window.goDoCommand('cmd_nextMsg')", "k": "window.goDoCommand('cmd_previousMsg')", "o": "window.goDoCommand('cmd_openMessage')", "f": "window.goDoCommand('cmd_forward')", "#": "window.goDoCommand('cmd_delete')", "r": "window.goDoCommand('cmd_reply')", "a": "window.goDoCommand('cmd_replyall')", "x": "window.goDoCommand('cmd_archive')", "u": "if (((window.document.activeElement.id == 'messagepane') || (window.document.activeElement == 'threadTree' )) && (window.document.getElementById('tabmail').tabContainer.selectedIndex!=0)){ window.CloseTabOrWindow()}; window.goDoCommand('cmd_getMsgsForAuthAccounts'); window.goDoCommand('cmd_expandAllThreads')" }
How can I adapt the excellent morat code (quoted below) to tbkeys, in order to assign the command to the "c" key? - Code: Select all
var kNoRemoteContentPolicy = 0; var kBlockRemoteContent = 1; var kAllowRemoteContent = 2; var msgHdr = gMessageDisplay.displayedMessage; if (msgHdr) { var remoteContentPolicy = msgHdr.getUint32Property("remoteContentPolicy"); if (remoteContentPolicy == kBlockRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kAllowRemoteContent); } else if (remoteContentPolicy == kAllowRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kNoRemoteContentPolicy); } window.content.focus(); }
Thanks.
tanstaafl
Moderator

Posts: 47491Joined: July 30th, 2003, 5:06 pm
Posted July 18th, 2020, 5:40 pm
I was pleasantly surprised to read: "Thunderbird 78 compatibility: Converts extension from legacy bootstrapped extension to MailExtension with a WebExtension Experiment." on the tbkeys web site. That means it has a future. It also states: "To customize keybindings, modify the "Key bindings" entry in the add-on's preferences pane which can be accessed from the add-on's entry in the Add-ons Manager ("Add-ons" in the Thunderbird menu). The "Key bindings" entry should be a JSON object mapping keybindings (with Mousetrap syntax) to javascript code to execute (see here for cmd name references). The default keybindings can be restored by deleting all the text the "Key bindings" field and clicking "Submit". The preferences page will not allow invalid JSON to be submitted, but it does not sanity check the keybindings otherwise." I suspect you need to learn the Mousetrap (A simple library for handling keyboard shortcuts in Javascript) syntax. See https://craig.is/killing/mice
morat
Posts: 4334Joined: February 3rd, 2009, 6:29 pm
Posted July 18th, 2020, 7:34 pm
These code snippets work correctly in the error console in Thunderbird 68. Multiple line code snippet with the double quote characters: - Code: Select all
(function () { var kNoRemoteContentPolicy = 0; var kBlockRemoteContent = 1; var kAllowRemoteContent = 2; var msgHdr = gMessageDisplay.displayedMessage; if (msgHdr) { var remoteContentPolicy = msgHdr.getUint32Property("remoteContentPolicy"); if (remoteContentPolicy == kBlockRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kAllowRemoteContent); } else if (remoteContentPolicy == kAllowRemoteContent) { setMsgHdrPropertyAndReload("remoteContentPolicy", kNoRemoteContentPolicy); } window.content.focus(); } })();
Single line code snippet with the single quote characters: - Code: Select all
(function () { var kNoRemoteContentPolicy = 0; var kBlockRemoteContent = 1; var kAllowRemoteContent = 2; var msgHdr = gMessageDisplay.displayedMessage; if (msgHdr) { var remoteContentPolicy = msgHdr.getUint32Property('remoteContentPolicy'); if (remoteContentPolicy == kBlockRemoteContent) { setMsgHdrPropertyAndReload('remoteContentPolicy', kAllowRemoteContent); } else if (remoteContentPolicy == kAllowRemoteContent) { setMsgHdrPropertyAndReload('remoteContentPolicy', kNoRemoteContentPolicy); } window.content.focus(); } })();
I guess you could paste the single line code snippet into the background.js file like so. (not tested) - Code: Select all
- "c": "window.MsgNewMessage()", + "c": "(function () { var kNoRemoteContentPolicy = 0; ... window.content.focus(); } })();",
tbkeys http://github.com/willsALMANJ/tbkeyshttp://github.com/willsALMANJ/tbkeys/blob/master/addon/background.js
Last edited by morat on July 19th, 2020, 8:03 pm, edited 2 times in total.
Return to Thunderbird Support
Who is online
Users browsing this forum: Google [Bot] and 3 guests
|