Configuration: Ubuntu 18.04 LTS, GNOME Tweaks 3.28.1 (I believe it's pre-installed in 18.04), Middle Click Paste: OFF

Problem: It's not disabling middle click paste, although it worked once (until after the first restart with that option set to OFF).

Question: What is the actual shell command that disables the MCP feature?

Reasoning behind the question: I figured that GNOME Tweaks is executing that command by toggling that ON/OFF option and that it may use the wrong command now. This might be due to a dist-upgrade that changed the command.

  • I am providing a partial solution to this problem. Using the gnome-tweak-tool the middle-click paste can be disabled for anything Gnome provides. However, it seems to be a convention of software developers to include the middle-click paste into their applications. For Firefox type about:config into the address bar, click away the warning, then search for middlemouse.paste and set it to false. For Pycharm, go to File, Settings, Keymap, Editor Actions, Paste from X Clipboard, remove the shortcut there. If this comment helped you, please upvote the question. – Johannes Klaus Apr 14 at 8:36

Underneath, Tweaks alters the dconf key


You can do the same in terminal, either via dconf (e.g. to turn it off):

dconf write /org/gnome/desktop/interface/gtk-enable-primary-paste false

or via gsettings (e.g. to turn it back on):

gsettings set org.gnome.desktop.interface gtk-enable-primary-paste true
  • 1
    This isn't working in Ubuntu 18.04 (either through tweak UI or these cli commands). Any ideas what changed? – M J Jun 20 '18 at 20:07
  • 1
    @MichaelJackson - it worked and still works fine here. I don't use Ubuntu. – don_crissti Jun 21 '18 at 6:50
  • This answer is not relevant to the question. :( – lolmaus - Andrey Mikhaylov Sep 21 '18 at 15:32
  • The question is specifically about Ubuntu 18.04. Your solution does not work in Ubuntu. Saying "I don't use Ubuntu" does not help either. – lolmaus - Andrey Mikhaylov Sep 21 '18 at 15:36
  • @lolmaus-AndreyMikhaylov - not really, the actual question, if you read the post, is: "Question: What is the actual shell command that disables the MCP feature?" and my post answers exactly that question and not follow-up questions like "why doesn't this work in Ubuntu?" – don_crissti Sep 21 '18 at 15:49

I am not using Ubuntu, and I found an answer that also works on Centos here.

xmodmap -e 'pointer = 1 25 3 4 5 6 7 8 9'

If you have more mouse buttons, you keep adding them; this allows the pointer to be mapped to a different action, but middle mouse is kind of a pain now that we aren't using ancient mice with springs that require a kilogram of force. :)

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.