5

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 '19 at 8:36
1

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
| improve this answer | |
  • 1
    This isn't working in Ubuntu 18.04 (either through tweak UI or these cli commands). Any ideas what changed? – majgis 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
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. :)

| improve this answer | |
  • This is this only solution that worked for me on Ubuntu. – Robert Dundon Sep 17 at 0:09
1

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.

| improve this answer | |
1

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

| improve this answer | |

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.