How to disable Middle-click paste

I use many tools for drawing diagrams (system design, UI sketches) such as Figma, Canva and Miro. The standard behavior for these tools is to navigate through the document by holding the middle mouse button. But in KDE, it pastes the contents of the clipboard. It’s really annoying, the tools are almost unusable because navigating by keyboard is obviously inconvenient.

I tried to disable this behavior by unchecking Middle-click: Pastes selected text, but it doesn’t work.
It’s possible to disable this behavior in Firefox-based browsers. But it’s not convenient for me because I use Chromium-based browsers mostly.

KDE: 6.3.4
Session: Wayland

1 Like

The setting works in chromium in my testing.
You need to log-out for the setting to be applied, as systemsettings tells you.

Middle-click text pasting is very old and standard since forever. I did implement this setting WaylandServer: Add a setting to disable PrimarySelection (!2487) · Merge requests · Plasma / KWin · GitLab.

I didn’t know this was possible to disable this in firefox as it ignores compositor (https://www.reddit.com/r/firefox/comments/11by5gk/how_do_i_disable_the_highlight_middle_mouse/) but it has clipboard.autocopy about:config setting apparently.

1 Like

Middle-click text pasting is very old and standard since forever.

I understand it, but operating systems are evolving, and users’ needs are changing. For the Wayland example, why not stay on x11 if it’s been the standard for many, many years.

I don’t mind pasting by the middle-click, but IMHO, there should be an option to disable it. I can use the tools I mentioned above on macOS, Windows and I would like to use them on Linux (with KDE).

I’ve just rechecked with rebooting the system and the same behavior: pasting selected text while navigating on Canva whiteboard. I’m not sure, maybe it’s a Fedora bug.

Chromium Version 135.0.7049.114 (Official Build) Fedora Project (64-bit)
Fedora 42 6.14.4-300.fc42.x86_64 (64-bit)

This isn’t a matter of ‘new standards’ it’s a similar problem to ‘why not just keep upgrading your Austin Morris Minor?’. There comes a time when the code is not manageable - but the standards are another matter.

Furthermore, it isn’t feasible to scrap this behaviour because a couple of applications misbehave… The only time this bothered me was when I used a fresh desktop and middle-clicked the desktop (usually to bring up a menu, switch desktops) and ended up with an annoying Stick-it note there instead… easily fixed with settings.

So the issue is that releasing the middle button pastes text when you want to navigate… and I found one Firefox tweak here: https://forum.figma.com/archive-21/release-of-middle-mouse-button-paste-text-from-clipboard-33508

There’s a note that says you can use Spacebar and Left Click to hold and pan instead.

Miro is separate (these actions are controlled by software). This issue on a CHROMEBOOK, so it is not KDE Plasma specific.

With Miro, it appears that Shift and LMB does the job - try that.

Figma apparently has a fix using a Greasemonkey script.

Greasemonkey Script:
A userscript can block pasting only in Figma. Install the Greasemonkey addon and use code that cancels paste events during middle-click drags

// ==UserScript==
// @name     Fix Figma
// @match    https://www.figma.com/*
// ==/UserScript==
// [Full script provided in search results]

For Firefox, use middlemouse.paste=false

Generally, when issues occur with software it’s good to look at that software’s forum for solutions.

Just to give a quick opinnion & idea:

While scrolling by holding MMB is sometimes useful, if I can only have one of them, I preffer middle-click-pasting. But I would really appreciate it if more applications would implement it correctly..

But… why can’t we have both? I mean as in:

  • short press & release => paste
  • hold => scroll

If I remember correctly, this is basically how it’s handled with the trackpoint on Thinkpads since more than a decade. Why not everywhere else as well?

2 Likes

If you use Plasma and KWin, only it can restrict this feature centrally (or try to).

Did you check with canva in firefox with middle click pasting disabled (clipboard.autocopy) ?
And is it disabled on other websites ? Is it the clipboard content that is pasted (and not the currently selected text) ?

A website or application can re-implement the middle click pasting by themselves although not fully.

1 Like

If nothing else, you should be able to use an application like keyd (GitHub - rvaiya/keyd: A key remapping daemon for linux.) or input-remapper (GitHub - sezanzeb/input-remapper: 🎮 ⌨ An easy to use tool to change the behaviour of your input devices.) to remap the wheel mouse button to some keystroke.

I use keyd to map two “extra” mouse buttons to keystrokes, which are configured in the KDE shortcut settings to trigger the Overview effect, and move the top window to my other screen.

3 Likes

+1 for input-remapper which is a good tool for intercepting existing inputs and redirecting them to your needs.

1 Like

I agree. It’s a bad example. Maybe I can provide another one, like arrow keys and WASD in FPS, but it doesn’t make sense. Let’s talk substance.

I disagree with that. Not a couple of applications. Almost every drawing tool supports middle-click navigation. If you look at forums, there are tons of questions related to the issue. The number of threads on the forums further proves that the problem exists. But thank you for providing possible workarounds.

In summary, thank you guys for providing workarounds and possible hacks. It definitely works:

  • Using Firefox with middlemouse.paste works.
  • Using 3rd party tools and scripts works as well.
  • Some tools reimplemented middle-click pasting (like draw io).

And I don’t mind about middle-click pasting at all. My complaint was about another point. On Linux, where you can customize almost everything, whatever you want: disable CapsLock, change keyboard layout by any hotkey, open folders\files by single-click or double-click. Among this customization, you can’t configure such a trivial thing as middle-click pasting. And you have to ask developers of each tool to fix it on their side, whereas on Windows and macOS it works initially. :exploding_head:

Quite right - I load GIMP, I can also load Krita and can use the Middle Mouse to click and move the canvas.

So far I haven’t experienced the problem which you mention… which is why I think it’s relative to the individual software.

I have not experienced the need to disable middle-click paste except on my desktop, which can be done in the desktop settings.