How do I enable Middle mouse button emulation in 12.04 LTS?

71,142

Solution 1

GUI solution

Install the package gpointing-device-settings

Description-en: configuration tool for pointing devices
 GUI tool for setting pointing devices. Currently it can configure mouse type
 device (mouse, trackpoint etc.) and touchpads.
 .
 For mouse you can configure middle button emulation, wheel emulation and
 scrolling.
 .
 It can enable and disable touchpad, or scrolling on it as well as additional
 parameters like palm detection, locked drags, tapping and scrolling.
 .
 It is a successor of GSynaptics.

gpointing-device-settings middle mouse button emulation

Console/terminal solution #1

Alternatively, try this:

gsettings set org.gnome.settings-daemon.peripherals.mouse middle-button-enabled true

The alternative solution might require the installation of gnome-settings-daemon package.

Console/terminal solution(s) #2

Using synclient command you can view your synaptics touchpad options.

  1. Run synclient and see what variables you have available.

  2. You can set/change the synclient options using this command: syclient var=1 (where var is the variable you wish to change and 1 the value)

    Read the manual page about each variable: http://manpages.ubuntu.com/synaptics


What worked for me

Instead of figuring out how to press both buttons of the touchpad, keep/press two fingers on the touchpad and click on the left click button of the touchpad with a third finger. This emulates a middle button by default.

What worked for the original poster

a) Setting the TapButton variable works for the two fingered tap

b) If you still want to click both buttons and produce a middle button emulation, execute:

synclient EmulateMidButtonTime=100

EmulateMidButtonTime allows you to change the time required to produce a middle button (allowed time period to click both buttons). 100 means 100 milliseconds (ms).

You may set it to even higher values, such as synclient EmulateMidButtonTime=500 (500ms).

Solution 2

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

Same issue still in Ubuntu 20.x.

Solution

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

  1. Query your device:

     xinput list
    

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

  1. xinput list-props 10 gives me the settings for the mouse.

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

     xinput set-prop 10 "libinput Middle Emulation Enabled" 1
    
  3. Check if the value changed to 1:

     xinput list-props 10
    

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

In a recent Ubuntu 20.x connecting a Logitech Marble Mouse with 2 buttons (old, white model) gave me "libinput Middle Emulation Enabled (292): 0" and I changed it accordingly.

In Ubuntu 18 and XFCE there is a significant change: NO LONGER "libinput Button Middle". Instead "Evdev Third Button Emulation". So the whole line is now (for my machine):

sudo xinput set-prop 10 "Evdev Third Button Emulation" 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.

HINT: If yor flavour or surface of Linux GUI does not support xinput you might get a little error line each time you open a terminal.

Better solutions are always welcome :-)

This is what is behind it.

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 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):

  • 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
  • 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.

Addendum

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

Wayland is different.

Sometimes it is helpful to enter

gsettings set org.gnome.settings-daemon.peripherals.mouse middle-button-enabled true

With some luck it is persistent. Else try to create a start script.

Solution 3

You can also set the middle mouse button on a triple-finger-tap by calling

synclient TapButton3=2

(Put this in a script and add it to your startup programs)

It is strange, cause there seems to have been a bugreport, that supposed to have been fixed.

source: enable a three finger tap on my synaptic touchpad:

Solution 4

Enable it for all users by changing the default value in /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.peripherals.gschema.xml:

Look for the key middle-button-emulation that looks like this:

<key type="b" name="middle-button-enabled">
  <default>false</default>
  <summary>Middle button emulation</summary>
  <description>Enables middle mouse button emulation through simultaneous left and right button click.</description>
</key>

Change default to true:

<key type="b" name="middle-button-enabled">
  <default>true</default>
  <summary>Middle button emulation</summary>
  <description>Enables middle mouse button emulation through simultaneous left and right button click.</description>
</key>

Solution 5

I found a nice solution using xubuntu 14.10

(I think this is nice because it doesn't require tap to click to be enabled, I don't like tap to click)

First you need to install xdotool

sudo apt-get install xdotool

Then write a bash script to send the middle mouse click. Your going to want to write something like this

#!/bin/bash 

xdotool mousedown 2;
xdotool mouseup 2;

Save it to a filename you'll remember like "MiddleClick.sh"

next change your permissions to the file to make it executable for yourself

chmod u+x MiddleClick.sh 

You can now send a middle click to where ever your mouse is by running this file, in terminal it would be

bash MiddleClick.sh

However, to assign a shortcut to do this, go to Settings > Keyboard and go into the Application shortcuts. Add a new one, point to the file you created and assign a shortcut. you can now use this new shortcut to send a middle click.

Share:
71,142

Related videos on Youtube

Rqomey
Author by

Rqomey

Senior Support Engineer in virtzilla

Updated on September 18, 2022

Comments

  • Rqomey
    Rqomey almost 2 years

    How do I enable Middle mouse button emulation in 12.04 LTS? I think it was disabled by default in the last release. I'm sure this is a silly question but I can't find a generic answer, they all seem to be touchpad specific (ie, multi-touch related, which I don't have), or using what I consider not to be normal ubuntu methods (creating xorg.conf file). I'm using xubuntu variant (xfce) on a dell inspiron mini.

    I was actually just testing there and if I tap with both fingers at once it brings up a context menu (like right click). Wired I didn't know this trackpad could even tell that there was a two finger tap...

    Former behaviour was clicking both touchpad buttons (they are the built in kind) at the same time produced a middle clicck. They no longer do this. I never used a double tap, but the actual buttons.

    To clarify I am using a built in Touchpad, not an external mouse. Gpointings detects it as synaptic touch, which I believe is correct

    Update- The question @medigeek linked to below let me set a two fingered tap to emulate a middle click, but I still cant click both buttons at the same time

    output from synclient is here:

    LeftEdge                = 1760
    RightEdge               = 5302
    TopEdge                 = 1639
    BottomEdge              = 4479
    FingerLow               = 25
    FingerHigh              = 30
    FingerPress             = 256
    MaxTapTime              = 180
    MaxTapMove              = 232
    MaxDoubleTapTime        = 180
    SingleTapTimeout        = 180
    ClickTime               = 100
    FastTaps                = 0
    EmulateMidButtonTime    = 0
    EmulateTwoFingerMinZ    = 282
    EmulateTwoFingerMinW    = 7
    VertScrollDelta         = 105
    HorizScrollDelta        = 105
    VertEdgeScroll          = 1
    HorizEdgeScroll         = 0
    CornerCoasting          = 0
    VertTwoFingerScroll     = 0
    HorizTwoFingerScroll    = 0
    MinSpeed                = 1
    MaxSpeed                = 1.75
    AccelFactor             = 0.0378931
    TrackstickSpeed         = 40
    EdgeMotionMinZ          = 30
    EdgeMotionMaxZ          = 160
    EdgeMotionMinSpeed      = 1
    EdgeMotionMaxSpeed      = 422
    EdgeMotionUseAlways     = 0
    TouchpadOff             = 0
    LockedDrags             = 0
    LockedDragTimeout       = 5000
    RTCornerButton          = 2
    RBCornerButton          = 3
    LTCornerButton          = 0
    LBCornerButton          = 0
    TapButton1              = 1
    TapButton2              = 3
    TapButton3              = 0
    ClickFinger1            = 1
    ClickFinger2            = 1
    ClickFinger3            = 0
    CircularScrolling       = 0
    CircScrollDelta         = 0.1
    CircScrollTrigger       = 0
    CircularPad             = 0
    PalmDetect              = 0
    PalmMinWidth            = 10
    PalmMinZ                = 200
    CoastingSpeed           = 20
    CoastingFriction        = 50
    PressureMotionMinZ      = 30
    PressureMotionMaxZ      = 160
    PressureMotionMinFactor = 1
    PressureMotionMaxFactor = 1
    ResolutionDetect        = 1
    GrabEventDevice         = 1
    TapAndDragGesture       = 1
    AreaLeftEdge            = 0
    AreaRightEdge           = 0
    AreaTopEdge             = 0
    AreaBottomEdge          = 0
    HorizHysteresis         = 26
    VertHysteresis          = 26
    ClickPad                = 1
    RightButtonAreaLeft     = 0
    RightButtonAreaRight    = 0
    RightButtonAreaTop      = 0
    RightButtonAreaBottom   = 0
    MiddleButtonAreaLeft    = 0
    MiddleButtonAreaRight   = 0
    MiddleButtonAreaTop     = 0
    MiddleButtonAreaBottom  = 0
    
  • Rqomey
    Rqomey almost 12 years
    Thanks, I tried that gpointing-device-settings option already (it was suggested in another question), but it doesn't give me the option to enable emulation. Second option doesn't seem to be working either, is an X restart required?
  • macrobook
    macrobook almost 12 years
    Did you do a clean install using the xubuntu-desktop live cd? gpointings enables middle mouse for mouse devices. What device are you using? Perhaps it's not detected properly? Btw, I'm surprised you need such a feature, nowadays mouse devices have a scroll button which you can click (press down) and that is the middle button essentially.
  • macrobook
    macrobook almost 12 years
    gpointings works with my mouse device
  • Rqomey
    Rqomey almost 12 years
    No it was an update from 11.10. It is a touchpad so unfortunately there is no middle button. Gpointings detects it as a syn touchpad (just like the screen above), it gives loads of options just not the emulate one!
  • macrobook
    macrobook almost 12 years
    (1) Run synclient and add the output in your question. (2) Try these solutions: askubuntu.com/questions/12435/… (3) you can set synclient using syclient var=1 (var the variable and 1 the value). Read the manpage: manpages.ubuntu.com/synaptics (4) Try this: Keep two fingers on the touchpad and click on the left click with a third finger
  • Rqomey
    Rqomey almost 12 years
    I have updated the question with more info. Thanks for your help, setting the TapButton var works for the two fingered tap, but clicking both buttons still doesn't produce a middle click. Just fixed it- I had to set synclient EmulateMidButtonTime=100 You showed the way so am accepting your answer, if you could edit to include this line it would be great!
  • pd12
    pd12 about 9 years
    console/terminal solution #1 can be GUI if you install dconf-editor and navigate to org.gnome.settings-daemon.peripherals.mouse and tick middle-button-enabled. Neither console/terminal solutions work for my mice (non-touchpads), synclient inherently because it's for touchpads. gpointing-device-settings works for different input devices. (recently had a clicking bug for me but it mostly works)
  • odedbd
    odedbd over 8 years
    On Ubuntu 14.04 using the synclient option worked for me. I set TapButton2=2 and TapButton3=3 to keep the right click available via 3 fingers tap and the middle click available via two fingers tap.
  • jotrocken
    jotrocken almost 8 years
    This does not work in more recent versions of Ubuntu, but this workaround should: askubuntu.com/questions/456452
  • ppetraki
    ppetraki about 7 years
    outstanding! Thank you. Worked perfectly on 17.04
  • catbadger
    catbadger over 6 years
    Doesn't work on 16.04. fails with error 'property 'libinput Middle Emulation Enabled' doesn't exist, you need to specify its type and format'
  • piepi
    piepi over 6 years
    @catbadger Maybe you need the evdev version. Look at the with evdev section in askubuntu.com/a/868173/460211 . I was getting the same error and this worked.
  • opinion_no9
    opinion_no9 about 6 years
    In Ubuntu 18 and XFCE there is a significant change: NO LONGER "libinput Button Middle". Instead "Evdev Third Button Emulation". So the whole line is now (for my machine): sudo xinput set-prop 9 "Evdev Third Button Emulation" 1 This answers the comment from catbadger Nov 23 '17; do I hate the missing formatting in comments? no comment - may be you get the gist anyways.
  • Leo Simon
    Leo Simon almost 6 years
    I[m finding that @opinion_no9's original suggestion, i.e., using libinput works with 18.04, at least for most applications. evdev didn't work for me. Maybe you have to set it up manually in xorg.conf before it will work?
  • opinion_no9
    opinion_no9 almost 6 years
    Leo Simon' s suggestion is right: Depending on U. version and GUI (Gnome, XFCE4, Wayland) sometimes works sometimes not. In U 17.04, -.10 nothing OK, server crashes etc.. U18.04 and U18.10 are good quality again, middle mouse works fine ;-). I'm always surprised how great the touchpad of my Fujitsu laptop works with XFCE4: Scrolling at right side, two-finger gestures, all works. The desktop with the Marble Mouse trackball I got the scrolling work for one of the small buttons. Unfortunately I often can not reproduce the positive achievements on other machines. However: Much to discover ...
  • Tasos Anesiadis
    Tasos Anesiadis almost 6 years
    Awesome answer. I have another problem though, I have to double click the middle button for the event to be recognized by my apps (VSCode, Chrome etc), the single middle click does not work at all. Anyone faced this?
  • Jim T. Tang
    Jim T. Tang over 2 years
    My god this is the most accurate solution ever! No need to re-login, it works like a charm!