Configuring mouse for right+left button simulating middle click (for copy/paste)

You can set this property with xinput. Run xinput list to see the list of connected input devices. Note the exact name or the number of the device corresponding to your mouse (not the “Virtual core pointer”, but something like “Logitech USB-PS/2 Mouse M-BA47”). The name depends on your mouse model; I think the number is assigned dynamically, so you might need to do a bit of parsing to cope with multiple machines.

Then, run

xinput set-prop "$device_name_or_number" "Evdev Middle Button Emulation" 1

Run xinput list-props "$device_name_or_number" to see a list of available properties, the exact set is different on different systems.

While you're at it, you might want to tune other settings (run xinput list-props "$device_name_or_number" to see what settings exist). In particular, by default, I think the emulated middle button will be the same as the mouse wheel press, but that should be fixable by reassigning the wheel button (Evdev Wheel Emulation Button).

See also Configuring Input Devices on the Ubuntu wiki.


With Ubuntu 17 and in XFCE the middle mouse button copy paste did not work at all.

SOLUTION:

To enable the middle mouse button paste function edit the xinput.

a) Query your device:

xinput list

Identify your mouse. With me it was device number 10.

b) xinput list-props 10

Gives me the settings for the mouse.

c) I need to change the value for "libinput Middle Emulation Enabled (294):" and I need to do it as root:

sudo xinput set-prop 10 "libinput Middle Emulation Enabled" 1

d) Check if the value changed to 1:

xinput list-props 10

Yes, it works: "libinput Middle Emulation Enabled (294): 1"

To make it persistent, add a line in ~/.xstartup!
In my case it just looks the same like before:

xinput set-prop 10 libinput Middle Emulation Enabled 1

That makes it effective from start on.

What is behind it: https://wiki.ubuntu.com/X/Config/Input

I strongly disagree that Ubuntu and Gnome decided to disable the standard Unix Middle Mouse paste. Even in XFCE Ubuntu 17 it is devastated. May the managers behind this decision find a soon and painful end. You make my life hard.

Many, many thanks to Gilles (https://unix.stackexchange.com/users/885/gilles) who found the solution!!!

I had the same issues using Ubuntu 16, 14.10 and earlier: Unix style copy paste in the terminal not working. Disappointing default settings. However, here is a solution (partly a wrap up of other peoples great work):

2) To fix the terminal issue I successfully put the following lines into my xorg.conf:

(see if /etc/X11/xorg.conf is suitable for you. May be different for Lubuntu etc.)

Section "InputClass"

   Identifier "middle button emulation class"

   MatchIsPointer "on"

   Option "Emulate3Buttons" "on"

EndSection

1) The very anoying malfunction of a missing 3rd mouse button (touch pad, Marble Mouse) can actually be fixed with the "gpointing-device-settings". Just install using CLI with

apt-get install gpointing-device-settings

. Then invoke gpointing-device-settings to get the gui window. Remark: There is an unfixed bug in newer Ubuntus that wipes out your settings when rebooting. You may put gpointing-device-settings in auto-start but still need to prompt then. I am not aware of any proper config solution.

Probably some steps need a sudo or root access. I assume you know.

However, now I can use the unixish copy paste by mark and middle mouse button. At least in terminal. And for the Marble Mouse there is a separate article with a lot of config details.


It is configured in /etc/X11/xorg.conf.

You'll see a section that looks like

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ImPS/2"
        Option          "Emulate3Buttons"       "true"
EndSection

Here is a random vaguely relevant link from SU.

https://superuser.com/questions/258649/multi-button-mouse-on-x11-how-can-i-configure-several-buttons-to-act-as-the-midd