0

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 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 belive 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

9
  • Please edit your question in an attempt to be concise and specific. The rambling can be omitted. This is a Q&A site that collects information based on user problems for the perusal of future users.
    – vanadium
    Jul 18, 2022 at 11:28
  • 3
    Does this answer your question? How do I disable middle mouse button click paste?
    – vanadium
    Jul 18, 2022 at 11:31
  • it is indeed hard-coded into the system ("why" is irrelevant in this case, it just is) and therefore any way of fixing the issue is a "hack". It seems like you are looking for some kind of magic solution that somehow the entire internet hasn't found yet. Perhaps there is one, but I am not optimistic.
    – Esther
    Jul 18, 2022 at 14:41
  • FWIW it appears KDE Plasma on Wayland has implemented a way to disable middle-click to paste about a month ago. In X11 there is still no good way to disable the feature, as it is indeed hard-coded.
    – Esther
    Jul 18, 2022 at 14:46
  • 1
    @isebarn there are 3 different "clipboards" built into X11. one uses select to copy and middle-click to paste, another uses ctrl-c and ctrl-v. The second was replaced by Gnome-native clipboard. It was this way in Unix, and most/all Linux adopted the behavior. The "primary selection" clipboard (which uses select and middle-click) is actually an entirely different clipboard than the system one. The select/middle-click behavior is hard-coded, not sure why but it is.
    – Esther
    Jul 18, 2022 at 19:05

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.