I am running Ubuntu 15.04 on a Dell XPS 13 from 2013. Since 13.04 I sometimes get accidental middle clicks/middle click emulation. I can tell this is happening because text in my clipboard pastes itself (default behaviour on Ubuntu) at random times.
Can anyone tell me why this is happening and how I can disable it?
Run the following command:
To persist this behavior, edit ~/.Xmodmap and add
For Ubuntu 18.04 and later (which have middle mouse button emulation enabled by default):
Create a script called
disable-middle-button-emulation
with following contents:Then run
chmod a+x disable-middle-button-emulation
to set execute enabled bit and then you can run it with./disable-middle-button-emulation
. If you put the file in your home directory under subdirectorybin
, you don't need to prefix the command. As an alternative, you can put all of the above in file~/.xsessionrc
which gets automatically executed whenever you start a new X session.To verify the system behavior (before or after the above change), run
xev
, move mouse pointer over thexev
window and press both left and right buttons simultaneously. If you get "button 2" (middle mouse button) in the terminal output, emulation is still active. You should get separate events for "button 1" (left mouse button) and "button 3" (right mouse button). Note that if the simulation is active, the event from pressing mouse button 1 or 3 down will be delayed 50 ms which causes extra lag for everything in the system. If you truly want to use emulation but reduce lag, you can modify the above script to look forButton Emulation Timeout
and adjust it to your liking. The default value is50
which means 50 ms.