Pretty sure most of you already know this but for those who don’t: you have two clipboards in Linux. One is the traditional clipboard where you copy with control c and paste with control v. The other one is when you highlight text and use the mouse middle click to paste text.

More details here.

71 points
17 points
*

Is this applicable for Wayland as well? That link makes several references to X and its ecosystem of tools.

permalink
report
parent
reply
14 points

If I understand it correctly, Wayland only specifies a single clipboard but no primary. But most (all?) wayland compositors implement an additional protocol that’s also supported by the toolkits (gtk, qt, …) and programs like wl-clipboard.

So yes, wayland also has clipboard + primary. But no secondary, as far as I found. Though I never used secondary on X anyway.

permalink
report
parent
reply
50 points

Ironically neither GNU nor Linux has a clipboard (well GNU Emacs probably has like 37 of them for some reason). “Primary selection” (the other clipboard that people don’t tell you about) started off on X11, which of course had to implement by XFree86, which became Xorg, and then it copied (ha ha) by other non-X-related software like gpm and toolkits like GTK when using Wayland.

permalink
report
reply
5 points

Emacs’s regular clipboard is the “kill ring” which also allows you to retrieve any previously cut/copied text. It also has “registers” where you can store and retrieve snippets of text, which can be considered clipboards when used for this purpose. Registers can be referenced by any character you can type on your keyboard, including control characters like ^D.

This totals… a lot of clipboards.

permalink
report
parent
reply
48 points

Btw it makes using other OSs painful when you are used to it…

permalink
report
reply
31 points

Not going to lie, I hate the middle click clipboard and disable it ASAP. I really dislike the idea that it copies things without my explicit permission.

permalink
report
reply
49 points

I don’t believe anything is actually copied until you request it to be pasted. The clipboards in Linux mark where the data is, and don’t actually initiate a copy until there’s a destination.

https://wiki.archlinux.org/title/clipboard

permalink
report
parent
reply
10 points

Yes. You can test this by selecting something, closing that window and attempting to paste. It won’t work. Closing the window removes the information about what was highlighted, so there is nothing to paste. If it were to copy upon selection you’d still be able to paste.

permalink
report
parent
reply
26 points

It’s one of the things that I hated at first when moving from Windows, but then I got so used to it I just can’t live without it. Whenever I use Windows, I would try to quickly copypaste text using selection, doing so for 5-10 seconds, until I realise this is not a thing on this OS.

permalink
report
parent
reply
17 points

Ditto. And sometimes I use both the Ctrl+C and middle-click clipboards at the same time, when I want to copy two chunks of text. Like this:

  • Select chunk A, press Ctrl+C
  • Select chunk B
  • Shift window
  • Paste chunk B through middle-click
  • Paste chunk A through Ctrl+V
permalink
report
parent
reply
5 points

Windows and KDE Plasma both have CMD + V to show a list of all things that have been copied. So I always just do Ctrl + C, Ctrl + C, Ctrl + V, CMD + V -> down arrow -> enter. Though on KDE Plasma you will need another Ctrl + V to actually do the pasting after you have selected the value to paste, whereas on Windows selecting the value also pastes it. But the workflows are very similar.

permalink
report
parent
reply
12 points

Lol I have gotten so used to it that I can barely use web terminals that don’t support it

permalink
report
parent
reply
4 points

I actually like the feature but could you explain how you disabled it? I’ve tried to merge all three clipboards into one a few years ago and couldn’t make it work

permalink
report
parent
reply
3 points

KDE has the option to disable middle click paste, so I do that. Out of sight, out of mind

permalink
report
parent
reply
1 point

Whenever I use a touchpad without physical buttons, I usually disable the middle button entirely. It’s more of a hammer-to-mosquito solution than what you were asking, but it’s as easy as adding this command to the autostart file (on Xorg): xinput set-button-map "Name-of-your-Touchpad-goes-here" 1 0 3 4 5 6 7, where “Name-of-your-Touchpad-goes-here” can be found with xinput list --name-only.

permalink
report
parent
reply
29 points

I use auto scroll a lot, middle click paste is generally an immediate no for me.

permalink
report
reply
10 points

How do middle-click-to-paste and middle-click-to-scroll conflict? In Firefox I can click-to-paste if the cursor is over an input field and click-to-scroll anywhere else. Never had any problem with this behavior.

permalink
report
parent
reply
7 points

How do middle-click-to-paste and middle-click-to-scroll conflict?

Some of us are clumsy.

permalink
report
parent
reply
1 point

That’s not something I thought about. Good thing that you can disable the feature then

permalink
report
parent
reply
4 points

How did you setup auto scroll? It doesn’t work for me.

permalink
report
parent
reply
5 points

You can’t in most apps but Firefox allows it. It requires an app to specifically enable the behavior instead. It’s terrible.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.6K

    Monthly active users

  • 6.1K

    Posts

  • 170K

    Comments