HOWTO turn mice wheels off

Share your own howto's etc. Not for support questions!

HOWTO turn mice wheels off

Postby Meow » 2015-04-14 19:14

Cat hair and other dirt tend to make mouse wheels over-sensitive.
This in turn makes the middle mouse button unusable.

This HOWTO describes a script to turn off the wheels conveniently.

This HOWTO requires intermediate skills on your part:
-Knowledge how to save files, how to chmod them executable and how to call them from your personal startup file

Code: Select all
#!/usr/bin/perl
use strict;

# make sure you installed xinput - not default in some distros

# get output of "xinput list"
my $xinp = `xinput list`;
# get the mice id
(my @mida) = $xinp =~ /^.*\s+id=(\d)\s+\[slave\s+pointer.*$/gm;
foreach my $mid (@mida) {
  # now get info for this mouse device
  $xinp = `xinput list $mid`;
  # get the information in the "Button labels" line
  (my $bl) = $xinp =~ /^\s+Button labels:\s(.*)$/gm;
  # separate the button descriptions
  # if there are any unparenthesized "None" in the file, escape them
  $bl =~ s/None/"None"/g;
  my @btnt = split(/\"\s\"/, $bl);
  # now get the button map
  my @bmap = split(' ', `xinput get-button-map $mid`);
  # build the command string to be executed
  my $cmd = "xinput set-button-map $mid";
  for (my $bid = 0; $bid < scalar @bmap; $bid++) {
    $cmd .= ' ' . ($btnt[$bid] =~ /.*Wheel.*/ ? '0' : $bmap[$bid]);
  }
  # finally turn off the wheels :)
  `$cmd`;
}


Make sure that xinput is installed (quickly done using synaptic).
Copy this code, make it executable and modify your startup so that it is executed at each system start.
And bingo, no more annoying wheel scrolling!
User avatar
Meow
 
Posts: 2
Joined: 2015-04-13 23:32

Re: HOWTO turn mice wheels off

Postby mardybear » 2015-04-15 00:09

Meow wrote:Cat hair and other dirt tend to make mouse wheels over-sensitive.
This in turn makes the middle mouse button unusable.
This HOWTO describes a script to turn off the wheels conveniently.
And bingo, no more annoying wheel scrolling!

Why would you want to disable the functionality of mouse scrolling?
Wouldn't it be easier just to clean your mouse?
800mhz, 512mb ram, dCore-jessie (Tiny Core with Debian Jessie packages) with BusyBox and Fluxbox.
Most don't have computer access, reuse or pay forward an old computer.
User avatar
mardybear
 
Posts: 994
Joined: 2014-01-19 03:30

Re: HOWTO turn mice wheels off

Postby Meow » 2015-04-15 02:31

mardybear wrote:Wouldn't it be easier just to clean your mouse?


I did... I have piled up four mice over time due to this. Cleaning the movement sensor when the mouse movement gets jerky due to cat hair is quite easy. I am routined in opening and cleaning mice. The bad thing is the delicate scroll wheel mechanism that is very hard to clean.. If it gets dirty, you can (erratically) scroll by just moving the mouse. Cleaning reduces this to a *very* sensitive mouse wheel. Just touching the wheel can make scroll.
I am just fed up of piling up more mice just because of that useless scroll wheel. I prefer to scroll using keys or the bars anyway. So I wrote that script..
User avatar
Meow
 
Posts: 2
Joined: 2015-04-13 23:32


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

fashionable