2

I'm trying to make my 97 years old grandma's laptop(Ubuntu 20.04) more accessible for her. She often is frustrated because mail text that she has written in Thunderbird message compose window vanishes. Disabling the touchpad and using an external mouse already helped a lot. But I suspect that she still accidentally selects text, when she tries to place the text cursor with her mouse(by dragging or double-clicking). When she continues typing the selected text is being overwritten. Because she needs to focus on the keyboard while typing she won't notice immediately what happened – making it difficult to "Undo".

  1. Would it be possible to disable this behavior in Thunderbird message compose window so that selected text would be deselected instead of replaced, when typing?
  2. If changing the behavior is not possible, can I disable text selection via mouse in general?

Thanks for any technical hints or other ideas on how to address this! Possible answers might involve hidden Thunderbird settings/workarounds or instructions on how solve this via custom script/(web-)extension.

Note: To narrow this down this question is about how to solve this problem in Thunderbird message compose window specifically. I also asked this question for Libreoffice Writer and as a question on askubuntu.com for a system-wide solution.

2

Proof of Concept: userChromeJS addon + custom user script

To answer my own question: I managed to pull of this hack which deselects the current selection before the user continues typing.

If someone knows how to turn this into a real Thunderbird MailExtension, feel free to update this answer or start your own!

Setup

  1. Install the experimental Thunderbird-Addon userChromeJS
  2. Create a folder chrome inside your Thunderbird profile directory
  3. Create a text-file named userChrome.js there with the following content:
    function deselect(e) {
      if(e.ctrlKey || e.altKey || e.metaKey || e.keyCode === 16) {
        return; // don't do anything if those keys are pressed
      }
      let currentWindow = e.view
      let selection = currentWindow.getSelection(); 
      selection.collapseToStart();
    }
    window.addEventListener("keydown", deselect);
    
  4. Restart Thunderbird

Caveats

  • The userChromeJS addon is flagged experimental
  • This hack was tested with Thunderbird 68.10.0. It may not work with other versions.
  • It works for Thunderbird's messenger-composer window where you're typing your message content but currently not for other inputs like recipient etc.
  • There may be adjustments needed to handle edge cases
  • It currently listens to all keyboard presses from all Thunderbird windows
  • 1
    That's great, you could find a solution Firefox & Thunderbird. Just a note about the link. Addons were legacy and no longer supported. Both had already made the shift to WebExtensions / MailExtensions respectively. Here is the related page for MailExtensions developer.thunderbird.net/add-ons/mailextensions – user.dz Nov 10 '20 at 20:42
  • @user.dz Thank's for the clarification. The addon I used seems to already be a MailExtension. The GitHub-Page states it was ported to Thunderbird 78 – that's the version where support for the old addon-standard ended. So I guess my solution should work on TB 78+ too – maybe someone can confirm? – Anton S. Nov 10 '20 at 20:58
  • As it worked for you, then sure it is a MailExtension. I just wanted the point out the correct doc, in case you wanted to carry on creating one. So you don't waste effort on old doc (that's usually hard to truck on FLOSS projects) – user.dz Nov 10 '20 at 21:03
  • 1
    Thanks, I'm sure it will help others. I still feel quite lost in the API. I would like very much to turn this hack into a real MailExtention. I found out there is a composeScripts-API since TB 77 that may be the way to access the messager-composer window. Not sure how to add the keydown-Listener though. Will window just be the message-compose window? I also found this example for a similar API that could be adjusted. – Anton S. Nov 10 '20 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.