tbkeys icon indicating copy to clipboard operation
tbkeys copied to clipboard

[QUESTION] Is there a command for showing remote content?

Open techmuch opened this issue 1 year ago • 15 comments

For example, I would like a hotkey to show images within an html email

techmuch avatar Apr 09 '23 19:04 techmuch

I would also love to know if there is a command for this.

When first installing tbkeys-lite a year or two back, could not track it down. Ended up having to hack together an AutoHotkey shortcut that sends the literal keypresses, so when I use Alt + C in mail reader window it sends the key sequence exactly as if you were pressing Alt + O (opens options menu from button) then S (selects and runs the Show Remote Content entry).

It works, but feels hacky compared to knowing the TB internal command. And of course it's Windows only, since afaik there is no AHK for Mac or Linux...

Here is my AHK code in case it's helpful to others until someone sorts out the internal TB command:

;### ThunderbirdDone fixes
; Show Remote Contect shortcut to Thunderbird
#IfWinActive ahk_exe thunderbird.exe
	; alt + c
	!c:: ; Thunderbird Show Remote Content
	Send {Alt down}o{Alt up}s
return
;### END: Thunderbird fixes

trulycool avatar Apr 09 '23 19:04 trulycool

It appears that once upon a time, TB had an internal command to do this:

LoadMsgWithRemoteContent

http://kb.mozillazine.org/Keyconfig_extension:_Thunderbird

...however sadly, this does not appear to work w/ current TB versions :(

trulycool avatar Apr 09 '23 19:04 trulycool

The following command works with the error console.

window.LoadMsgWithRemoteContent();

Are you using tbkey or tbkeys-lite?

You cannot run arbitrary javascript with tbkeys-lite.

There is a tbkeys.xpi link on the GitHub releases page.

morat523035 avatar Apr 09 '23 21:04 morat523035

Well would you look at that, it works great in console!

I am currently running tbkeys-lite, I ended up w/ that since it was what was available in Thunderbird Add-ons.

I guess they not allow you to list the regular tbkeys there because of the ability to run arbitrary javascript w/ eval? Frustrating...

I wrote a somewhat extended plea on the TB keybinding API request thread you mention in the tbkeys repo.

Thank you for all your hard work on this extension, and for taking the time to respond to this thread. Much appreciated 🙏

trulycool avatar Apr 10 '23 00:04 trulycool

Thank you @morat523035 !

While I hack about Firefox & FF Extensions, rarely mess w/ Thunderbird (tho it is my main mail app). Hadn't even tried the Dev Tools console...

I just assumed that TB had dropped the command altogether. But after seeing it run via console...was inspired to push a bit more...

And just after writing a [probably way too long] impassioned plea to the Thunderbird dev thread where @wshanks points in the full tbkeys repo, wherein he succinctly explains how his extension and the wonderful Nostalgy were both hobbled by the removal of a proper keyboard API...

I went back to the tbkeys-lite options, and noticed that in addition to the cmd: prefix, which calls internal TB commands, and which did not work w/ LoadMsgWithRemoteContent, there is a func: prefix too...

And voila! We can haz keyboard shortcut to 'Show remote content in message' w/ tbkeys-lite!

"ctrl+shift+c": "func:LoadMsgWithRemoteContent"

Thanks to all for the code and info; open source rules!

🙏🙌🕸

trulycool avatar Apr 10 '23 01:04 trulycool

Works perfectly!!! 🙏 🙏 🙏

techmuch avatar Apr 10 '23 13:04 techmuch

Thank you for your hard work and dedication to open-source software it is greatly appreciated. Thank you for making email management even easier!

techmuch avatar Apr 10 '23 13:04 techmuch

Since thunderbird 115 update func:LoadMsgWithRemoteContent is not working anymore

Crandel avatar Jul 26 '23 11:07 Crandel

The LoadMsgWithRemoteContent function is now defined in the aboutMessage.xhtml window, not the messenger.xhtml window.

Try the following command with tbkeys.

window.gTabmail.currentAboutMessage.LoadMsgWithRemoteContent();

You cannot run arbitrary javascript with tbkeys-lite.

There is a tbkeys.xpi link on the GitHub releases page.

About new mail front end http://developer.thunderbird.net/thunderbird-development/codebase-overview/mail-front-end http://developer.thunderbird.net/add-ons/updating/tb115/adapt-to-changes-in-thunderbird-103-115

morat523035 avatar Jul 26 '23 14:07 morat523035

I'm using tbkeys, but have no idea how to run this code. This is my settings and nothing happens when I press Ctrl+h.

"ctrl+h": "(function () {window.gTabmail.currentAboutMessage.LoadMsgWithRemoteContent(); window.content.focus();});"

Crandel avatar Jul 26 '23 14:07 Crandel

Try this:

"ctrl+h": "window.gTabmail.currentAboutMessage.LoadMsgWithRemoteContent();"

Remember to select a message with blocked remote content before running that command.

Troubleshooting http://forums.mozillazine.org/viewtopic.php?p=14872763#p14872763

morat523035 avatar Jul 26 '23 15:07 morat523035

Thank you. Now everything is working correctly

Crandel avatar Jul 26 '23 15:07 Crandel

"ctrl+h": "(function () {window.gTabmail.currentAboutMessage.LoadMsgWithRemoteContent(); window.content.focus();});"

Here I think the issue might have been a missing ( -- you have an unmatched ) at the end. I think the end should be ().

wshanks avatar Jul 26 '23 15:07 wshanks

Try this:

"ctrl+h": "window.gTabmail.currentAboutMessage.LoadMsgWithRemoteContent();"

Remember to select a message with blocked remote content before running that command.

is this still working for people? I can't find a way to make it work. I'm on tbkeys-lite 2.2.4 and TB 115.8.0

fabiankirsch avatar May 01 '24 16:05 fabiankirsch

@fabiankirsch

You cannot run arbitrary javascript with tbkeys-lite.

There is a tbkeys.xpi link on the GitHub releases page.

You can use the cmd shorthand and func shorthand with tbkeys and tbkeys-lite.

Use the cmd shorthand for calling a command using the goDoCommand method.

For example, "cmd:cmd_nextMsg" is the same as "window.goDoCommand('cmd_nextMsg');".

Use the func shorthand for calling a function on the window object without an argument.

For example, "func:MsgNewMessage" is the same as "window.MsgNewMessage();".

P.S.

You can test the arbitrary javascript using the error console.

i.e. Menu Bar > Tools > Developer Tools > Error Console

The command works for me on Thunderbird 115.8.1.

morat523035 avatar May 01 '24 16:05 morat523035