34

In Firefox, swiping on the touch screen results in selecting text, instead of scrolling (like on an iPad). Is it possible to change the behaviour, so that the touch screen can be used to scroll, while the mouse can be used to select text?

In Chrome, the behaviour is as expected (swipe to scroll, (mouse)drag to select).

I'm using Firefox 50.0 on Linux Mint 18 (based on Ubuntu 16.04). I have dom.w3c_touch_events.enabled set to 2, setting it to 1 does not help either.

Thanks for any help!

Matthijs Melissen
  • 797
  • 1
  • 7
  • 7

6 Answers6

36
  1. Edit /etc/security/pam_env.conf and add this line:

     MOZ_USE_XINPUT2 DEFAULT=1
    
  2. Log out and in again

see https://askubuntu.com/a/994483/34298

rubo77
  • 4,680
  • 11
  • 45
  • 79
34

I finally found a solution: start firefox with:

env MOZ_USE_XINPUT2=1 firefox

This enables touch-scrolling for me. Pinch-to-zoom does not work for regular web pages, but it does work on some selected web pages such as Google Maps or OpenStreetMap.

jsve
  • 269
  • 2
  • 12
Matthijs Melissen
  • 797
  • 1
  • 7
  • 7
  • 1
    does not work for me using v 51.0.1 (64-bit) – dusoft Feb 28 '17 at 06:06
  • 3
    More detail here: https://bugzilla.mozilla.org/show_bug.cgi?id=1268599#c10 – Shimon Rura Apr 22 '17 at 01:02
  • 1
    @ShimonRura thx, xsetwacom --set {id} Gesture off, helped! – Ivan Fateev Apr 27 '18 at 06:03
  • Thank you, that helped me as well! Use `xsetwacom --list devices` to figure out the id of your touch device. See also https://github.com/linuxwacom/xf86-input-wacom/wiki/Multitouch – iliis Aug 20 '19 at 14:01
  • It seems to have changed. now this is the solution: https://askubuntu.com/a/994483/34298 – rubo77 Sep 22 '19 at 10:41
  • For Firefox 77 it worked on Xubuntu 20. I added the env variable to `/etc/environment` so that it's automatically set when starting firefox from the desktop or task bar shortcut. – Lion Jun 23 '20 at 06:32
5

Firefox supports touchscreen properly when running in wayland mode, however currently that must be enabled manually.

You can check if you are running firefox in wayland mode or xwayland mode by going to about:support and scrolling to "Window Protocol"

If you are in xwayland mode, you can tell firefox to use wayland mode instead by setting MOZ_ENABLE_WAYLAND=1 in your environment variables.

If firefox is installed as a flatpak, run this (you might need root if installed system-wide):

flatpak override --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox

Otherwise if firefox is installed through repo packages, you should add the following line to /etc/security/pam_env.conf:

MOZ_ENABLE_WAYLAND DEFAULT=0 OVERRIDE=1
MattSturgeon
  • 151
  • 1
  • 2
  • 1
    Verified the pam_env.conf change works on Ubuntu 22.04 with default Firefox (snap). You would need to reboot the system after the changes for this to take effect. – x__x Dec 28 '22 at 15:01
3

Just updating with the new format in /etc/security/pam_env.conf --now variables must be defined with a default value (which can be empty, "") and an override value (which can be empty, "").

Add the environmental variable like this:

MOZ_USE_XINPUT2 DEFAULT=0       OVERRIDE=1
Toto
  • 17,001
  • 56
  • 30
  • 41
  • Verified the pam_env.conf change works on Ubuntu 22.04 with default Firefox (snap). You would need to reboot the system after the changes for this to take effect. – x__x Dec 28 '22 at 15:01
1

With the latest Firefox 84.0.2 it works for scrolling without the risk of getting zoom while scrolling for both vertical and horizontal movements. Zoom works well on most pages with finger/thumb pinch/expand including Google Maps. Select is now activated, as on a mobile, by touch for a second or so then using the select markers. Touch and hold the selection to get the context menu for copy and cut/paste if text is editable. Better functionality than Chrome where the select markers cannot be adjusted from a single word selection!

My screen was detected as a "Wacom 5113 finger" under KDE Plasma 5.2 Manjaro/Arch Linux. I set KDE Wacom touch control panel "gestures off" otherwise weird things start happening on scroll.

Simply edit /etc/security/pam_env.conf and add MOZ_USE_XINPUT2 DEFAULT=1 then reboot.

The only loss seems to be drag items do not drag with finger input but will still work by mouse/touchpad.

Ian Newton
  • 11
  • 2
  • Verified the pam_env.conf change works on Ubuntu 22.04 with default Firefox (snap). You would need to reboot the system after the changes for this to take effect. – x__x Dec 28 '22 at 15:01
0

Open up terminal and paste this command

echo export MOZ_USE_XINPUT2=1 | sudo tee /etc/profile.d/use-xinput2.sh

Mike
  • 1
  • An explanation will be welcome. – Toto Sep 23 '22 at 19:01
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 23 '22 at 22:25
  • Can it be inside `.bashrc`? – Ziyuan Oct 25 '22 at 19:00