Disabling middle mouse paste Linux

The “middle mouse button paste” behavior of X11 can lead to posting unwanted text in a document when you’re simply trying to scroll through it.

Disable Linux middle-mouse button paste

  1. In Terminal:

    xmodmap -pp
    

    Telling the active mouse button function indices. The second number is apparently the middle mouse button function, which we will map to an unused index. Example output of xmodmap -pp:

    There are 10 pointer buttons defined. 
    Physical Button      Button Code 
    1                    1 
    2                    2 
    3                    3
    4                    4 
    5                    5 
    6                    6 
    7                    7 
    8                    8 
    9                    9 
    10                   10
    
  2. Edit ~/.Xmodmap - swap the last number with the second number. Keep a backup of your original ~/.Xmodmap file if one existed. For the example above, edit and save:
    pointer = 1 10 3 4 5 6 7 8 9 2
    
  3. Logout / login

the middle-mouse paste should be disabled, while you are still able to use the middle mouse button to scroll.

Notes

Categories:

Updated:

Leave a Comment