I use a MS keyboard on my Debian machine. The problem is that MS does not ship configuration software for us and touchpad's default scrolling directions are reversed (it uses natural scrolling).

I wonder if it's possible to tweak the input from the particular input device somehow so it behaves "normally". I.e. I would like to replace scroll-up and scroll-down commands.


You can control some settings of input devices with xinput. Run xinput list to list devices. Each device has a name and a numerical ID. You can use either this name or this ID to list properties of the corresponding device. Device IDs can depend on the order in which the devices are detected, so to target a specific device, use its name. For example, I have a mouse as device 8; here's an excerpt of its properties:

$ xinput list-props 8
    Evdev Axis Inversion (272):     0, 0
    Evdev Axes Swap (274):  0

Either of the following commands makes my cursor go right when I move my mouse left, and up when I move it down:

xinput set-prop 8 272 1 1
xinput set-prop 8 'Evdev Axis Inversion' 1 1

If you want to swap the direction of wheel emulation, there are properties for that: change Evdev Wheel Emulation Axes from 6 7 4 5 to 7 6 5 4.

| improve this answer | |
  • Thank for pointing to the xinput, that was very helpful. But the Evdev Wheel Emulation Axes is not the option I was looking for. This option only works with the emulated wheel (i.e. if when I emulate the wheel with the middle click). Haven't figured out how to invert native scroll wheel yet. – Kolyunya Sep 5 '15 at 13:21
  • @Kolyunya So what do you want to tweak: the wheel feature, or normal cursor movement? – Gilles 'SO- stop being evil' Sep 5 '15 at 13:23
  • I would like to tweak only scroll wheel direction, not the cursor movement. The Evdev Wheel Emulation Axes does not work with the physical wheel, only with the emulated one. Maybe it's possible to use the --set-button-map to swap Button Wheel Up and Button Wheel Down? – Kolyunya Sep 5 '15 at 13:29

After a kind pointing by @Gilles to xinput I was able to swap scroll directions by using the set-button-map command.

First you should lookup the device id or name using the list command and then remap scroll wheel buttons like this xinput set-button-map id 1 2 3 5 4 7 6.

Published a small script which does this automatically.

| improve this answer | |

Remapping an individual device with xinput and .xsessionrc

I had a similar issue where I wanted to reverse scrolling on one device. The ID didn't work for me because it changed with each start up. Using the device name did work.

Type the following line in terminal to find the name of the device:

    xinput list

Then use a text editor to edit or write .xsessionrc in the home directory. Example:

    vim ~/.xsessionrc

Note: I recommend typing "sudo vim ~/.xsessionrc" to simplify issues with write permissions if the file already exists, as was in the initial example before review.

Then add the following line to .xsessionrc with "name" replace by "device name from xinput list". Keep the quotes.

    xinput set-button-map "name" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

For example, I wanted to reverse vertical scrolling (4 5) and horizontal scrolling (6 7) on my "Microsoft Wedge Touch Mouse". xinput list gave me:

    ⎜   ↳ Microsoft Wedge Touch Mouse               id=15   [slave  pointer  (2)]

So I added the following line to .xsessionrc

    xinput set-button-map "Microsoft Wedge Touch Mouse" 1 2 3 5 4 7 6

Finally, log out and in.

This worked on Mint Cinnamon 17.3

| improve this answer | |

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.