First, install xinput package if already not installed.
$ sudo apt-get install -y xinput
Next, list input devices and look for your mouse:
$ xinput list | grep 'id='
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v1.0 id=11 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v1.0 id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
...
OK, so it tells me what input devices are connected. Under Virtual core pointer, I see my Microsoft Mouse, which is mapped to 11 and 12. In my case, it was the first device:
$ xinput get-button-map 11
3 2 1 5 4 6 7 8 9 10 11 12 13
The second number represents mapping of the middle button, so I simply disable it by setting it to 0:
$ xinput set-button-map 11 3 0 1
That's it. I now confirm that the middle mouse button no longer functions! Well, I want to keep it this way all the time, so I created a script
$ echo "xinput set-button-map 11 3 0 1" > ~/disable_middle.sh
$ chmod u+x ~/disable_middle.sh
I made it execute every time GNOME starts up by creating diable-middle-button.desktop file in ~/.config/autostart/ folder with the following
[Desktop Entry]
Type=Application
Exec=~/disable_middle.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=disable-middle-button
Name=disable-middle-button
Comment[en_US]=
Comment=
Now, your mouse middle button will be disable every time you start up GNOME!
$ echo "xinput set-button-map 11 3 0 1" > ~/disable_middle.sh
$ chmod u+x ~/disable_middle.sh
I made it execute every time GNOME starts up by creating diable-middle-button.desktop file in ~/.config/autostart/ folder with the following
[Desktop Entry]
Type=Application
Exec=~/disable_middle.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=disable-middle-button
Name=disable-middle-button
Comment[en_US]=
Comment=
Now, your mouse middle button will be disable every time you start up GNOME!
No comments:
Post a Comment