8

Holy moly guys ... This question has been asked on all boards everywhere on the internet.

I've read everything and I've gone beyond page 2 on Google search results

I am pleading can someone help me figure this out

I have seen answers like "it's hardcoded into the system". Why???

Enough rambling, now for the problem:

Problem: I need to disable the middle-click paste function

Corolary: I still need to be able to scroll using the middle button.

I am a software developer, using a Thinkpad keyboard. The one that has a trackpoint for a mouse.

I need to be able to scroll in editors like VS Code or Sublime Text without accidentally pasting the clipboard into the code without realizing it (which breaks the code)

I also need to be able to scroll using the trackpoint mouse + middle button.

Non-solutions:

  • turning the middle button completely off. I need it to scroll.
  • use Vim/Emacs (I have seen people suggest this)
  • Create an elaborate bash script with a while-loop that continuously blocks pasting if the event originates from the middle button

I believe this problem stems from the fact that this only affects those with thinkpads, since they are the only ones that have a trackpoint and a middle click button on the keyboard. Most people use a mouse with a scroll wheel so it's much harder for them to accidentally click the scroll wheel to paste.

Kind regards:

A ctrl + v user

mpanczak
  • 3
  • 2
isebarn
  • 181
  • 1
  • 4

2 Answers2

14

For VSCode there is a setting controlling this:

"editor.selectionClipboard": false (false corresponds to off)

(source: Disable middle-click paste · Issue #14610 · microsoft/vscode)

It is not named very intuitively, but it was the thing that finally stopped the behaviour in VS Code for me. In Sublime it was already disabled potentially due to other things I've already implemented:

  • Gnome Tweaks > Mouse > Disable Middle click paste
  • Running XMousePasteBlock on startup
1

I fixed it with input remapper. It has a graphical interface that lets you disable or modify usb inputs before other applications see them. I disabled the middle mouse click and scroll still works.