62

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?

Hack-R
  • 1,027
  • 2
  • 13
  • 23

6 Answers6

68

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? )

50ty
  • 796
46

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.

AsgerHB
  • 177
Ian Hincks
  • 2,911
  • 2
  • 28
  • 23
4

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)

Álvaro
  • 141
  • 3
4

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

Hack-R
  • 1,027
  • 2
  • 13
  • 23
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

Cas
  • 8,707
1

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