12

ive got problem with broken scroll wheel. (I know i shoud change mouse, its old). And i want to just disable wheel scroll but not middle button click.

I know that it is possible to do, but cant find that config file. (have no entry at xorg.conf)

1 Answer 1

16

Ive found out how to configure that. Open terminal window:

xinput list 

find there yours mouse id number

↳ A4Tech PS/2+USB Mouse id=8 [slave pointer (2)]

ive got ID=8

next:

xinput list 8

You ll see there

Button labels: Button Left Button Middle Button Right Button Wheel Up Button Wheel Down Button Horiz Wheel Left Button Horiz Wheel Right Button Side Button Extra Button Forward Button Back Button Task Button Unknown Button Unknown Button Unknown Button Unknown

they are counted by numbers 1,2,3,4,5,6,7 ...

now do that:

xinput get-button-map 8

you will got something like that

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

numbers 4 and 5 are for "mouse wheel up scroll" and "mouse wheel down scroll"

now we will disable them with zero number:

xinput set-button-map 8 1 2 3 0 0 

thats all.

5
  • Nicely done, and I learned some things from your answer. But an easier way of identifying the buttons (works for scrollwheel too) described here: unix.stackexchange.com/a/20595/28245
    – Lambart
    Sep 19, 2014 at 18:52
  • In short, assuming buttons 4 and 5 are the scroll wheel (they are for me, too), just put this line in a file called .Xmodmap in your home directory: pointer = 1 2 3 0 0 6 7 8 9 (note that I think this will disable any buttons beyond 9--add more numbers if needed)
    – Lambart
    Sep 19, 2014 at 18:54
  • 1
    this doesn't work in Ubuntu 16.04 but it works fine on Ubuntu Mate 16.04 :/ strange
    – fpilee
    Oct 14, 2016 at 15:49
  • In Ubuntu 18.04, I put the line xinput set-button-map 10 1 2 3 0 0 into my .bashrc and it prevents my mouse scrolling on all programs except my terminal (which is fine by me since I don't use the mouse in the terminal). Cheers +1!
    – mattb
    Aug 19, 2021 at 21:38
  • My mouse id changes (I think when I unplug my camera), so I have now put the following 2 lines in my bashrc: wireless_mouse_id=$(xinput list | awk '/.*2\.4G.*Mouse/ {print $9}' | sed 's/id=//') and xinput set-button-map $wireless_mouse_id 1 2 3 0 0
    – mattb
    Sep 19, 2021 at 10:59

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.