6

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.

1
  • 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.
    – jkf
    Apr 14, 2019 at 8:36

4 Answers 4

4

Underneath, Tweaks alters the dconf key

/org/gnome/desktop/interface/gtk-enable-primary-paste

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
11
  • 4
    This isn't working in Ubuntu 18.04 (either through tweak UI or these cli commands). Any ideas what changed? Jun 20, 2018 at 20:07
  • 1
    @MichaelJackson - it worked and still works fine here. I don't use Ubuntu. Jun 21, 2018 at 6:50
  • This answer is not relevant to the question. :( Sep 21, 2018 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. Sep 21, 2018 at 15:36
  • 1
    @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?" Sep 21, 2018 at 15:49
2

This askubuntu.com answer using xdotool and xbindkeys seems to work as advertised on my Ubuntu 18.04 system.

The specific configuration maps the middle button (or scroll wheel) click to double-click on primary button which effectively stops the undesired paste action.

Quoting the askubuntu.com answer, for convenience:

OS: Ubuntu 18:04
Required Packages: xdotool and xbindkeys

you can install these packages with sudo apt install xdotool xbindkeys

gedit .xbindkeysrc

Paste the below content

"xdotool click --repeat 2 1"
b:2

Save the file and run xbindkeys --poll-rc

now your Middle Click should work as double click.

The original answer also addresses Unity differences.

2

I had the same problem with the middle button pasting even though I turned it off in the dconf editor.

It turned out that the problem was only persisting in Mozilla Firefox and Thunderbird. They seem to have this functionality enabled by default as well.

This is how you can turn it off:

Firefox: Type about:config into the URL/search bar, click 'I accept the risk', search for middlemouse.paste and set it to false

Thunderbird: Go to Preferences > Advanced > General > Config Editor, search for middlemouse.paste and set it to false

1
  • 1
    Thank you for your explanation! This worked for me! Nov 4, 2020 at 8:39
1

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. :)

1
  • This is this only solution that worked for me on Ubuntu. Sep 17, 2020 at 0:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .