3

I was able to successfully install my Apple Magic Mouse into my installation of Ubuntu 11.10 out of the box, and I am happy with that! Thanks, Ubuntu, for supporting the Apple Magic Mouse out of the box.

However, I notice that the magic mouse has a very irritating behavior -- when you click the "middle button", it pastes the clipboard contents into the editor. This is problematic because the "middle button" is not clearly defined on the multi-touch mouse interface.

Is there a way of disabling the "middle button" behavior altogether on the Apple Magic Mouse without disabling any of the other behaviors, such as scrolling, etc.?

I would appreciate your response! Thanks!

5 Answers5

8

For the record, and since I just found this out: on Ubuntu 14.04 with a recent kernel (3.13), you can also add the following line to a file /etc/modprobe.d/magicmouse.conf:

options hid-magicmouse emulate_3button=0 
  • For the record, this works in Ubuntu 16.04, too. – John Franklin Jul 13 '16 at 18:18
  • For my money this exactly solves the problem for just the Magic Mouse without affecting other mice with physically discrete buttons. (Tested and working on Bionic) – Haqa Nov 06 '19 at 10:26
6

This mouse has the following buttons in this order: Button Left, Button Middle, Button Right, Button Wheel Up, Button Wheel Down, Button Horiz Wheel Left, Button Horiz Wheel Right. They can be manipulated with xmodmap. See "man xmodmap" for details.

To disable the middle click, create a ~/.Xmodmap file with this line:

pointer = 1 0 3 4 5 6 7 0 0 0 0 0 0

log out / log in to enable it.

If you want to reverse the scrolling direction (up with down and left with right), then change it to:

pointer = 1 0 3 5 4 7 6 0 0 0 0 0
blade19899
  • 26,704
Paul
  • 61
  • What exactly those numbers mean? I understand that is 1 > 12, but what exactly wich one does? Because I want to disable right click on Magic Mouse too and I think it can be done with those numbers ;) – euDennis Dec 21 '13 at 19:23
1
rmmod hid_magicmouse
modprobe hid_magicmouse emulate_3button=0
JHOSMAN
  • 133
1

The above answers, like most of StackExchange, have not aged well, particularly since Ubuntu has made major changes.

The recommended process is now to use the Gnome Tweaks applet, Keyboard & Mouse, disable Middle Click paste.

https://linuxconfig.org/how-to-disable-middle-mouse-button-click-paste-on-ubuntu-20-04-focal-fossa-linux

jbarlow
  • 111
  • 1
1

To disable the middle button you need to map button 2 (the middle button) to something like 1 (the left button) using xinput.

First get the ID of the magic mouse using xinput list.

Then run this in the terminal (at the command prompt) to reverse the scrolling (set natural scrolling without affecting the scrolling on your tracpad) as well as map the middle button to the left button (disable the middle button): xinput set-button-map ID 1 1 3 5 4 (replace ID with your magic mouses' ID - from the first step).

xinput set-button-map 10 1 1 3 5 4 7 6 will also allow you to scroll naturally from side to side (horizontally). Note ID=10 in this example.

See this page for details.

This works for me on Ubuntu 14.04 running on a Sony Vaio with a Magic Mouse (Mac mouse).

avjaarsveld
  • 111
  • 2