Disable Linux Mouse Scroll Wheel Click Paste
Follow the steps below to disable mouse middle or wheel click button:
From Terminal run xinput to discover the mouse device name
xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Microsoft Microsoft® Classic IntelliMouse® id=10 [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)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Belkin Corporation Flip CC id=8 [slave keyboard (3)] ↳ LITE-ON Technology USB NetVista Full Width Keyboard. id=9 [slave keyboard (3)]
Run xinput get-button-map with the mouse device name to output the mouse button map. The first three digits (1 2 3) of the map represent the left, middle, and right mouse buttons. Setting the digit in position 2 to zero disables the mouse middle or wheel click button.
xinput get-button-map "Microsoft Microsoft® Classic IntelliMouse®" 1 0 3 4 5 6 7
From Terminal run xinput as follows to disable middle button for the current session
xinput set-button-map "Microsoft Microsoft® Classic IntelliMouse®" 1 0 3 4 5 6 7
For a permanent solution create a desktop file, e.g. “mousewheelpasteoff.desktop” with the contents below and save it to ~/.config/autostart folder. This script will run at login to disable the wheel click button.
[Desktop Entry] Name=Disable mouse wheel click at login Comment=Disable mouse wheel click at login Exec=xinput set-button-map "Microsoft Microsoft® Classic IntelliMouse®" 1 0 3 4 5 6 7 Icon=utilities-terminal Terminal=false Type=Application Categories=Utility;Application
I would prefer the default for mouse wheel click paste was disabled. For me it has corrupted working script files and emails whilst viewing them by dumping arbitrary paste buffer content into random places whilst scrolling and accidentally clicking the mouse wheel. Admittedly I am heavy handed with my index finger but challenge anyone not to accidentally click the mouse wheel whilst scrolling and editing documents.