7

A long while ago, I created a ~/.Xmodmap reversing the 4 and 5 to create "natural scrolling":

pointer = 1 2 3 5 4 7 6 8 9 10 11 12

I source .Xmodmap in .xinitrc in the standard fashion (xmodmap $HOME/.Xmodmap &). This has worked for years without issues.

I just recently installed an application called cockatrice. I have no other issues with the program, except that, for some reason, when I scroll inside the program, my scrolling direction is not "natural" (i.e., it is as if my .Xmodmap is not being obeyed by only this application).

At first, I thought it was an issue with my Qt input module, but I realized that I have correctly declared QT_IM_MODULE to xim in my .xinitrc, and I've never had this issue with any other application.

Is this an application-specific issue, or is this Qt-specific? What should I try to further troubleshoot this (or solve it)?

Attempting to set this universally through xinput fails:

$ xinput list 
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
# unneeded information regarding my keyboard
$ xinput set-prop 2 "Evdev Scrolling Distance" -1 -1 -1
property 'Evdev Scrolling Distance' doesn't exist, you need to specify its type and format
6

It seems to be Qt specific (from trying in Qt Assistant). I think it is because Qt uses only the scrolling distance for its wheel events.

Instead of using xmodmap here, you can set your scrolling distance to negative values.

You can set it through a file in /etc/X11/xorg.conf.d/, for a mouse managed by evdev :

Section "InputClass"
        Identifier "Reverse Scrolling"
        MatchIsPointer "on"
        Option "VertScrollDelta" "-1"
        Option "HorizScrollDelta" "-1"
        Option "DialDelta" "-1"
EndSection

Or you can try with xinput first :

xinput set-prop <your device id> "Evdev Scrolling Distance" -1 -1 -1

(To get the device id : xinput list)

The properties are listed with the actual device. Here xinput list-props 12 should list the properties of the touchpad. As it is a synaptics touchpad, from this man page the property should be :

xinput set-prop <touchpad id> "Synaptics Scrolling Distance" -1 -1 (Only two values, vertical and horizontal edges.)

For the rule in the configuration file, it should work with MatchIsTouchpad :

Section "InputClass"
        Identifier "Natural Scrolling"
        MatchIsTouchpad "on"
        Option "VertScrollDelta" "-1"
        Option "HorizScrollDelta" "-1"
EndSection
  • I assume using this solution would mean no longer using xmodmap and then hoping that this would function universally? (Not a bad thing necessarily, just clarifying.) – HalosGhost Aug 9 '14 at 1:12
  • @HalosGhost Yes it should work everywhere. And xmodmap shouldn't be used at the same time, otherwise the scrolling is reversed twice for some apps .. – Leiaz Aug 9 '14 at 8:02
  • I finally got around to testing this, but the xorg conf file has no effect, and testing through xinput produces the error I mention in the edit of the OP. – HalosGhost Aug 14 '14 at 5:24
  • @HalosGhost Updated. For a synaptics touchpad the property seem to be "Synaptics Scrolling Distance". – Leiaz Aug 14 '14 at 10:40
  • The updated configuration has the desired effect but creates a side-effect of having incredibly jumpy scrolling. – HalosGhost Aug 16 '14 at 21:47
2

I want to supplement @Leiaz's answer.
In my case, I'm using Logitech M325.
$ xinput

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ HID 04b4:0823 id=10 [slave pointer (2)]
⎜ ↳ Logitech M325 id=12 [slave pointer (2)]
⎜ ↳ Logitech M185/M225 id=11 [slave pointer (2)]

$ xinput list-props 12

Device 'Logitech M325':
Device Enabled (152): 1
Coordinate Transformation Matrix (154): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Accel Speed (286): 0.000000
libinput Accel Speed Default (287): 0.000000
libinput Accel Profiles Available (288): 1, 1
libinput Accel Profile Enabled (289): 1, 0
libinput Accel Profile Enabled Default (290): 1, 0
libinput Natural Scrolling Enabled (291): 0
libinput Natural Scrolling Enabled Default (292): 0
libinput Send Events Modes Available (271): 1, 0
libinput Send Events Mode Enabled (272): 0, 0
libinput Send Events Mode Enabled Default (273): 0, 0
libinput Left Handed Enabled (293): 0
libinput Left Handed Enabled Default (294): 0
libinput Scroll Methods Available (295): 0, 0, 1
libinput Scroll Method Enabled (296): 0, 0, 0
libinput Scroll Method Enabled Default (297): 0, 0, 0
libinput Button Scrolling Button (298): 2
libinput Button Scrolling Button Default (299): 2
libinput Middle Emulation Enabled (300): 0
libinput Middle Emulation Enabled Default (301): 0
Device Node (274): "/dev/input/event16"
Device Product ID (275): 1133, 16394
libinput Drag Lock Buttons (302):
libinput Horizontal Scroll Enabled (303): 1

Note that there is a "Natural Scrolling Enabled (291)" property, change it to "1", the direction of your mouse wheel will be inverse.
$ xinput set-prop 12 291 1

If you want to wrap the procedure in a shell script, here it is:

#!/bin/bash

dev_id=$(xinput | sed -n '/Logitech M325/{s/^.*Logitech M325\s\+id=\([0-9]\+\).*$/\1/;p;}')

if [[ -z "$dev_id" ]];then
  exit 1
fi

nse_id=$(xinput list-props "$dev_id" | sed -n '/Natural Scrolling Enabled ([0-9]\+)/{s/^.*Natural Scrolling Enabled (\([0-9]\+\)).*/\1/;p;}')

if [[ -z "$nse_id" ]];then
  exit 1
fi

xinput set-prop "$dev_id" "$nse_id" 1
xinput list-props "$dev_id" | grep -o "Natural Scrolling Enabled ($nse_id):\s\+[0-9]" 

Change "Logitech M325" to the device name of your own one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.