59

I have noticed that touchscreen doesn't work in FireFox on Ubuntu 16 desktop (on a touchscreen laptop), which is a major bummer as I am a FireFox guy and the browser is 90% of what I use my personal computer for. Note that it works on non-linux FireFox and it works in Chrome/Chromium on Ubuntu.

I have done some research on this and found a lot of people with the same complaint 2 - 3 years back. In those cases the consensus was typically that FireFox just lacked some necessary technology to support this (some say GTK 3, others said something else). However they claimed that this issue was already fixed in the pre-released FF v50. Now FF 50 is out and I'm running it but it still doesn't work.

Is there something I can add, an Alpha / Beta / Dev / Nightly version I can use, or something I can do to Ubuntu itself to get this to work?

4

6 Answers 6

63

This worked for me (firefox 57.0.4, Arch Linux):

  1. open about:config in firefox to set dom.w3c_touch_events.enabled=1 (default is 2).

  2. edit /etc/security/pam_env.conf and add MOZ_USE_XINPUT2 DEFAULT=1

  3. reboot and restart firefox

(see also How can I get Firefox to recognize multitouch gestures on a touch screen? )

4
  • 19
    didn't need to edit about:config, setting the environment variable was enough. On FF60.
    – 3ventic
    May 21, 2018 at 8:21
  • 3
    this works except you want to disable the gestures to zoom as well. it's annoying to use 2-finger scroll and while you're scrolling it zooms in/out on the content. You can do this by adding -disable to the end of the values for browser.gesture.pinch.in and browser.gesture.pinch.out for example cmd_fullZoomReduce-disable
    – user5245
    Sep 30, 2018 at 0:30
  • The default dom.w3c_touch_events.enabled value of 2 seems to work just fine (Ubuntu 20.04 LTS and FF 80.0.1)
    – kiko
    Sep 9, 2020 at 4:41
  • no need for reboot, just log out an in again
    – rubo77
    Aug 30, 2022 at 9:13
43

Found this solution elsewhere: if I start firefox from the command line with

env MOZ_USE_XINPUT2=1 firefox

then touchscreen scrolling works for me. To avoid having to start firefox from the command line, you can edit the Unity app launcher exec code to include this. Default .desktop resides in /usr/share/applications but we'll copy it over to our home folder so that the changes we make are immune to be overriden by the package manager on update.

cp /usr/share/applications/firefox.desktop ~/.local/share/applications/
gedit ~/.local/share/applications/firefox.desktop

find the Exec line in the [Desktop Entry] section and change it to

Exec=env MOZ_USE_XINPUT2=1 firefox %u

Change the other exec lines too, if you feel like it. Those affect the options in the right-click menu.

EDIT: At some point this stopped working (I think because of an extension I installed). To fix it, I had to go to about:config in the browser, right-click, add a new boolean browser.tabs.remote.force-enable set to true. Warning: this is not recommended and could break stuff.

Adding a comment from Jeff G, you may also need to go to about:configand set dom.w3c_touch_events.enabled = 1.

9
  • 3
    In conjunction with XINPUT2=1, you might also need to go to about:config to set dom.w3c_touch_events.enabled=1 (default was 2). In my experience this enabled two-finger scrolling, while one finger still selects text.
    – Jeff G
    Mar 19, 2017 at 2:49
  • 3
    Note that you need to make sure you have a thing called e10s enabled. To find out if you do, open about:support and look for 'Multiprocess Windows'.
    – BudgieInWA
    Jul 7, 2017 at 8:13
  • 4
    There's also an (admittedly pretty stupid) alternate way to handle setting MOZ_USE_XINPUT2 - just add MOZ_USE_XINPUT2 DEFAULT=1 to /etc/security/pam_env.conf and then never worry about it again (probably)
    – rookie1024
    Nov 26, 2017 at 0:00
  • 2
    I would strongly recommend to never change package-managed files like the launchers in /usr/share/applications/*.desktop, because not only do they affect all users on the system and require root rights to change, they will also most likely get reverted again on the next software update. Also launching GUI apps as root like sudo gedit is bad because it easily messes up ownership of files in your home directory (e.g. caches, settings of that application) and breaks it when you try to use it normally again.
    – Byte Commander
    Apr 9, 2020 at 22:13
  • 3
    You should instead of this all place a copy of the .desktop file in your user's ~/.local/share/applications/ folder and change it to your liking in there, as regular user without sudo.
    – Byte Commander
    Apr 9, 2020 at 22:14
4

I found a browser plugin called Grab and Drag which adds this functionality to FireFox.

5
  • 2
    Do you mean this add-on? Jul 9, 2017 at 19:41
  • @PabloBianchi Yep that's the one
    – Hack-R
    Jul 9, 2017 at 20:21
  • 2
    Grab and Drag appears to be designed for touch-only or pen-only computers. If you'd still like to use the mouse to select text etc., it's rather too drastic a solution. The MOZ_USE_XINPUT2 works great, enabling kinetic scrolling, fling and drag-to-scroll. Oct 24, 2017 at 8:33
  • @LeifArneStorset Seems to work for me, but I'll definitely check out the other solution as well, thanks
    – Hack-R
    Oct 24, 2017 at 21:31
  • The add-on's page seems to be deleted =(
    – xjcl
    Apr 3, 2019 at 0:44
3

Firefox on Ubuntu 22.04 (Wayland)

To enable touchscreen finger scrolling in Firefox on Ubuntu 22.04 under Wayland display server you can enable Firefox Wayland support with the environment variable MOZ_ENABLE_WAYLAND.

Test from terminal with the following (close Firefox first):

MOZ_ENABLE_WAYLAND=1 firefox

To permanently set this, add to your profile settings:

echo "export MOZ_ENABLE_WAYLAND=1" >> ~/.profile

This environment variable should be the default on 22.10 onwards so not needed

2

Found (yet) another Firefox add-on that lets you do that. Hope this one remains available for longer than the other two suggested.

ScrollAnywhere

Once added, you have to go to Options > General and check the "Left button" box. I works for me on Ubuntu 18.04 LTS and Firefox 78.0.1 (64-bit)

1
  • July 31, 2020-- This is the only plugin that seems to exist and it works nicely.
    – Chris
    Jul 31, 2020 at 17:16
1

Install the "Drag to Scroll" plugin. https://addons.mozilla.org/en-US/firefox/addon/drag_scroll/

1
  • 1
    The add-on's page seems to be deleted =(
    – rubo77
    Sep 22, 2019 at 10:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .