I recently upgraded from 17.10 to 18.04 and the horizontal scrolling is inverted. Natural scrolling does not affect it in any way, suggestions on how to change it back? (swipe rigth to go left)
7 Answers
I also encountered this issue upon upgrading to 18.04, this was my solution:
Use xinput list
to find the device id of your touchpad.
Use xinput list-props yourdeviceid
. This will produce a long list of all the properties you can edit for that device. We're interested in a property to do with scrolling distance, on my system this is Synaptics Scrolling Distance (283)
. It should have two values, on my system (with natural scrolling enabled) these were -115, 115
(vertical distance, horizontal distance). Note the value in the parentheses, in my case 283, it's how we'll identify the property to change it.
Use xinput set-prop yourdeviceid 283 -115, -115
, replacing 283 and the scrolling distance values with whatever is appropriate. (The change is to make both values negative, which gives the desired result of "natural" scrolling.)
Notes:
This setting will not persist across system restarts, which is an issue all on its own. I use a .xsessionrc
file in my home directory to execute the xinput command on startup.
This will probably not work in 17.10, since Wayland does strange things to xinput.

- 619
-
It works! Sadly extended gestures does not work, at least on ubuntu gnome, if you switch on ubuntu on wayland they do work, but the touchpad is not optimized. – slurpin May 05 '18 at 10:10
-
2
-
This worked. But on the first reboot my login screen didn't appear. I had to CTRL+ALT+F7/F8 to recover. – MycrofD Jun 14 '18 at 15:35
-
2today the problem recurred. on further investigation, i found that my device id had changed from 13 to 14. is it normal? I then had redo everything, but is it normal for the device id to change? – MycrofD Jun 21 '18 at 09:45
-
2@MycrofD - It is normal for your device IDs to change, especially if you connect/disconnect other devices. It should be possible to identify devices by their readable name rather than ID. – John LaRocque Jul 13 '18 at 17:49
-
Ah, this wasn't quite working for me, but then I realized that my "xinput list" command actually shows two touchpad devices, and I'd been changing the settings on the wrong one (I have a Dell XPS 13 9350, and had to set the "DLL0704:01 06CB:76AE Touchpad" device and not the "SynPS/2 Synaptics TouchPad"). Might be something to check for people having trouble. I still consider this a regression from 17.10, so I'll see if I can file a bug... – Mike Hicks Aug 18 '18 at 01:06
-
1Worked fine for me under Ubuntu 18.04. Pretty annoying that something like this cannot be done ine normal settings (or it should just be default if you use natural scrolling). Example command without hard-coded id:
xinput set-prop "Synaptics TM3242-001" 309 -46 -46
– nspo Sep 03 '18 at 15:28 -
This is a temporary, non-persistent solution that requires user input every session; see the other answer by @Andras-Hovarth for a simple and permanent one. For this reason, I'll downvote this and upvote the other, plus add complete instructions for noobs. – Little me Jan 21 '20 at 13:00
See this:
https://help.ubuntu.com/community/SynapticsTouchpad
Use the following commands to set the amount and direction of natural scrolling (plus or minus values change direction):
synclient HorizScrollDelta=-100
synclient VertScrollDelta=-100
You can put this command in your autostart script to run it when you log in.

- 439
-
1
-
1Better answer than current top answer; pls upvote. If you want this to run every session, run a terminal, type 'sudo nano /etc/crontab -e' and add the following lines at the bottom
# Enable nautral scrolling on touchpad for both Horizontal and Vertical
&# This sets scroll speed & direction for all users, and might be overridden by user settings for scrollpad at login... let's see
&@reboot synclient HorizScrollDelta=-250
&@reboot synclient HorizScrollDelta=-250
.
Then exit Ctrl+x and save the file. As you can see from the comments, I'm experimenting and welcome feedback. – Little me Jan 21 '20 at 13:15
Here's a little script that does it for you
export id=$(xinput list | grep -i touchpad | awk -F"=" '{ print $2 }' | awk '{ print $1 }')
xinput list-props "${id}" | grep "Synaptics Scrolling Distance" | sed 's/[^0-9 \t-]//g' | while read a b c;
do
echo "${a} ${b} $((${c}*-1))";
xinput set-prop "${id}" "${a}" "${b}" "$((${c}*-1))"
done

- 15,657

- 111
-
Thanks for the script, one modification I would like to suggest
xinput set-prop "${id}" "${a}" "${b}" "${b}"
This would make it idempotent. Running the original script twice was removing the effect – Harendra Singh Feb 03 '19 at 07:32
I had this problem for a long time. I recently updated to Ubuntu 19.10 and it was still there, so I poked around again for solutions. It appears that this is due to having the (apparently obsolete) "synaptics" input driver installed either instead of or in addition to the "libinput" driver. To correct this, run these two commands:
sudo apt install xserver-xorg-input-libinput
sudo apt remove xserver-xorg-input-synaptics
After that, restart X11 by logging out and back in or restarting the system. I'm not quite sure if it started working for me immediately or if I had to toggle the Natural Scrolling setting on and off in the Mouse & Touchpad screen in Gnome settings -- I know that I had to adjust the Touchpad Speed since that was waaay off.
Solution here from Gnome's GitLab issues: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1808#note_629824

- 156
Delete the xserver-xorg-input-libinput by sudo apt remove xserver-xorg-input-libinput
.
Then create the file /usr/share/X11/xorg.conf.d/20-natural-scrolling-mouses.conf
with the following content:
Section "InputClass"
Identifier "Natural Scrolling Mouses"
MatchIsPointer "on"
MatchIsTouchpad "off"
MatchDevicePath "/dev/input/event*"
Option "VertScrollDelta" "-1"
Option "HorizScrollDelta" "-1"
Option "DialDelta" "-1"
EndSection
After rebooting, the scrolling issue was solved for me.
fwiw, I wrote a script based on these answers that will figure out all the input IDs and whatnot for you. Bonus: you can choose "NATURAL" or "REVERSE" scrolling by passing either as a positional arg to the script
#!/usr/bin/env bash
##############################################################
DESCRIPTION: Fixes touchpad natural scrolling for horizontal
##############################################################
set -x
set -e
TYPE="${1:-NATURAL}"
TOUCHPAD_ID=$( xinput list | grep Touch | sed 's/\s\s[.//;' | awk -F'=' '{print $NF}' )
PROPS=$( xinput list-props ${TOUCHPAD_ID} |
grep "Synaptics Scrolling Distance" |
sed 's/[^0-9][^0-9]*/ /g' | awk '{print $1" "$2" "$3" "}'
)
PROP1=$( echo "$PROPS" | awk '{print $1}' )
PROP2=$( echo "$PROPS" | awk '{print $2}' )
PROP3=$( echo "$PROPS" | awk '{print $3}' )
if [[ ${TYPE} == "NATURAL" ]]; then
xinput set-prop ${TOUCHPAD_ID} ${PROP1} -${PROP2} -${PROP3}
else
xinput set-prop ${TOUCHPAD_ID} ${PROP1} ${PROP2} ${PROP3}
fi

- 111
In case this is still an issue, you can also change your setting in: Setting | Devices | Mouse and Touchpad. There the option "natural scrolling" will enable changes in the scrolling behavior.

- 1
- 1
-
4not on the last release of ubuntu (18.04) that's why I made the post, the issue is fixed anyway! Thanks – slurpin May 30 '18 at 07:12
-
off
change scrolling direction in my case – alhelal May 25 '18 at 10:29