8

I'm trying to make my 97 years old grandma's laptop (Ubuntu 20.04) more accessible for her. She is often frustrated because text that she has written 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 so that selected text would be deselected instead of replaced, when typing?
  2. Is this a feature provided by the Linux system or is it implemented in each program? (Programs of interest are LibreOffice Writer and Mozilla Thunderbird)
  3. If changing the behavior is not possible, can I disable text selection via mouse in general?

Edit:

As suggested by @user-dz I created separate questions on how to address this issue in LibreOffice Writer and Thunderbird.
This question remains focused on how to solve this system-wide in Ubuntu 20.04.

Pablo Bianchi
  • 15,657
Anton S.
  • 219
  • 1
    The auto-select in the browser location bar is the most annoying thing in the world... I often want to fix one character and end up deleting the whole thing because it auto-selected. Argh! But to semi-answer your question, I'm afraid I've never seen such a possibility (not replace the selected text) anywhere. – Alexis Wilke Nov 05 '20 at 05:03
  • 1
    You might investigate different options for mouse hardware -- you can even change the microswitches for ones that need more force (but seeking out mice that need more force might be easier). You might want to look at scripting the mouse so that when ever there is a button release you add an extra click (which would reset the selection but make drag-selection impossible). Xdotool (man page) or similar should do this. – pbhj Nov 05 '20 at 19:07
  • 1
    Maybe you want to have look at this https://addons.mozilla.org/de/firefox/addon/disable-selection/ Could be extensions for Thunderbird work somewhat similar. Didn't test tbh. – neun24 Nov 06 '20 at 02:07
  • @user-dz Thanks for putting the bounty on my question! I'm still not sure on how to split the question as you suggested. Maybe I will keep this question for a system-wide solution as it fits into askubuntu. If I create seperate questions for each libreoffice, Thunderbird and Firefox would it be better to post them in another stackexchange? – Anton S. Nov 06 '20 at 15:08
  • 1
    @AlexisWilke Yeah! Sometimes there exist hidden keys in TB or FF in about:config but I didn't find anything useful in this matter – Anton S. Nov 06 '20 at 16:30
  • 1
    @pbhj That's a promising lead. Although I guess I'm experiencing this bug in xdotool which prevents me from registering anything to the mouse-click event: xdotool search . behave %@ mouse-click getmouselocation – Anton S. Nov 06 '20 at 17:18
  • @neun24 Thank you https://addons.mozilla.org/de/firefox/addon/disable-selection/ is still working in Firefox v82. I faced only one disadvantage, It does allow positioning of cursor in text box with left mouse click. – user.dz Nov 08 '20 at 08:46
  • 1
    @neun24 @user.dz Thanks, I've inspected the firefox-addon with the developer toolbar: it seems to work by injecting the css-rule * { -moz-selection: none; } into each page. This css-property has the limitation that it also prevents any placement of the carret via mouse. In fact placement via arrow-keys is also limited to inside the current paragraph/line with editors like Thunderbird's Messager-Composer. That's a pitty because I was able to apply this rule to Thunderbirds chrome/userContent.css and actually disabling selection in Messager-Composer! – Anton S. Nov 10 '20 at 20:16
  • 1
    @neun24 Experimenting with your suggestions finally led me to the javascript selection API which turned out to be applicable in Thunderbird's Messager-Composer! I documented the solution in the other question focusing on Thunderbird. – Anton S. Nov 10 '20 at 20:23

2 Answers2

2

The selected text is copied to PRIMARY selection buffer. You could monitor it and send Right arrow key if it changes, to move to the end of the selected text. This works with any application, not only LibreOffice/Thunderbird, at least on X11+GNOME.

# Install dependencies
sudo apt install xdotool  git build-essential libx11-dev libxtst-dev

Compile clipnotify

git clone https://github.com/cdown/clipnotify.git cd clipnotify make

Run the monitor, could be on ~/.xprofile, or under ~/.config/autostart/

while ./clipnotify;do xdotool key Right; done

Optional: To kill the monitor on any other Terminal

killall clipnotify

Probably are better ways to do this, maybe using Dbus.

Inspiration and useful links:

Pablo Bianchi
  • 15,657
  • That's interesting, xsel can be even used to clear the selection. I expect this works only for Xorg (not Wayland), right? – user.dz Nov 11 '20 at 19:48
  • 1
    @user.dz Wayland and GNOME implements primary selection, but clipnotify is based on XFIXES extension of X11. I couldn't find a more elegant way to monitor. – Pablo Bianchi Nov 11 '20 at 20:07
  • I tested it in 20.10. xsel didn't work (LibreOffice should have it's own buffer), Not big deal. Otherwise sending Right key works with minor effect in Terminal when it send such key intentionally. Anyway, it could be avoided by watching for active window using wmctrl so no action on some apps like terminal emulators. (Joke: Sure at that time it will be him (OP) helping his grandma, who else gonna open the terminal) – user.dz Nov 12 '20 at 13:57
1

Partial answer

  • (2) LiberOffice, Thunderbird and Firefox, each has its own implementation of text edit box.

    But there many tool that are build on top of a GUI kit like GTK, Qt, wxWidgets,.. So you may expect Gnome tools to be GTK based and KDE tools to be based on Qt. So change may be required at their level.

  • (3) With LibreOffice, I have only found this feature that may help:

    • Change the "selection mode" at the bottom status bar to "Block selection". Still can select with mouse but not double click.
  • (3) For Mouse Accessibility, I don't remember any action that require double-click (Only CAD, Games, IDE). Usually, tools have other way using keyboard shortcut or menu entry.

    • Disable double-click, Settings → Accessibility → Double-click Delay: Shortest (minimum).
  • (3) Mouse Settings, The previous step does not fix selection by Drag. A trick that may work is killing short moves by lowering pointer speed and raising its acceleration to compensate for long moves.

    • Settings → Mouse & Touchpad → Mouse Speed: Lower

    • Mouse Acceleration: Higher using

      xset [mouse [accel_mult[/accel_div] [threshold]]] [mouse default]
      

      (Permanent setting, should be a way using libinput or X)

  • (3) Minimize use of mouse for short moves (It may be hard to adapt)

    • Use of keyboard to move
    • Activate keyboard mouse keys, Settings → Accessibility → Mouse Keys
    • Change to TrackBall mouse
user.dz
  • 48,105
  • 1
    Thanks for your answer! Disabling double click selection in LibreOffice is a start! Let's see if there are further ideas. Digging in the source-code to produce my own custom LibreOffice or Thunderbird builds is currently no option for me. And I didn't find out yet if it would be possible to alter the mouse selection behavior via a simple Thunderbird-/LibreOffice- Extension. – Anton S. Nov 02 '20 at 12:45
  • 1
    Even though you're answer is only a partial answer it contains many useful ideas on how to make the mouse agnostic to erratic dragging and clicking. Thanks for the thorough research! – Anton S. Nov 12 '20 at 15:18