this post was submitted on 06 Jul 2023
14 points (64.0% liked)

Linux

47994 readers
1234 users here now

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

Related Communities

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

founded 5 years ago
MODERATORS
 

It seems like for at least a decade every application/framework has had their own paste buffer, and honestly I'm surprised this isn't "just working" out of the box by now.

  1. Open Terminal
  2. Run pwgen, double click one of the passwords.
  3. Middle click in Terminal, the copied password pastes just fine.
  4. Switch back to Chrome, CTRL-V into the password field.
  5. Realize 5 minutes later when you can't login with the user you've just created, it's because the content you pasted into the password field was an URL you copied in Chrome 15 minutes ago.

And don't even get me started on vim/neovim having yet another copy/paste buffer.

top 26 comments
sorted by: hot top controversial new old
[–] [email protected] 51 points 1 year ago (2 children)

Have you tried ctrl+shift+c to copy from terminal?

Terminal shortcuts to copy and paste are different, because ctrl+ may be a command

[–] [email protected] 7 points 1 year ago (1 children)

Yes, never have this problem thanks to the trusty ctrl+shift+c and ctrl+shift+v.

[–] [email protected] 4 points 1 year ago (1 children)

I have this problem the other way around, I always try to copy with ctrl shift c, out of muscle memory, but in chrome it opens up the devtools instead

[–] saucyloggins 5 points 1 year ago

You and me both. The worst is I have to use Teams for work and Ctrl+Shift+C is the shortcut to call the person you’re chatting with.

[–] [email protected] 2 points 1 year ago

Yeah this is probably the best way to do it. I think(?) the middle-click copy/paste has a separate buffer so you should use it separately from ctrl+c and ctrl+v.

[–] Quazatron 38 points 1 year ago (1 children)
  1. Tries to use Windows conventions on Linux, without bothering to learn the differences. A 30 second Google search would suffice.
  2. Fails.
  3. Posts a rant blaming Linux for "not working properly".
[–] BaconIsAVeg -3 points 1 year ago (1 children)

I've been using Linux since RedHat 4.2, and for a number of years in the early 2000's as a desktop. Since then it's mainly been as a server, and I just recently got back into running it as a primary desktop.

The "it's always been that way" argument is stupid and you should know better.

[–] Quazatron 17 points 1 year ago

Sorry for the rough tone, it's been a long week.

The question is not that it has always been that way. The question is that different systems do things differently and one must take time to learn it.

If I would use an Apple system I'd have to learn how things are done on it. Of course you can always compare different approaches, but take time to understand why the differences exist.

When I use Windows I often miss the middle click copy, but I'm not saying window copy paste is broken for the lack of it.

Again, sorry for being harsh. A vacation is very much overdue for me.

[–] kolorafa 29 points 1 year ago* (last edited 1 year ago) (3 children)

@[email protected]

Linux running X11 has 2 clipboards:

  • oldschool ( from terminal-only era ) => copy by selecting text (mostly in terminals) and paste using middle mouse click
  • more modern new style ( based on graphical interfaces ) => copy by ctrl+c (or ctrl+shift+c in terminals and such) and paste ctrl+v (ctrl+shift+v in terminals ...)

Normally both those clipboards work independent as they are handled by 2 different processes, so you can for example copy one text using ctrl+c and copy another text by only selecting second text, then you can paste both, one with middle click, second with ctrl+v

More and more distro have a clipboard managers that have a feature to "sync" both clipboards, but it's a lot of time disabled because it's more confusing people and sometimes annoying. Why it's confusing and disabled by default? Imagine that you selected some text, then did a ctrl+c, you move to some word document, select text, remove it, and want to Paste it. Guess what, the selecting you did to remove text did copy the selection to clipboard overriding what you did have there from ctrl+c.

Most if not all terminal emulators (konsole, gnome-terminal, xterm) support both clipboard styles, old-school select to copy, and new one but because the "ctrl+c" shortcut reserved to stop/interrupt applications they all decide to use ctrl+shift+c to do a copy. And yes, not only terminal emulators use ctrl+shift+c, I did have few encounters on some random apps, but most of the time, if ctrl+c is used for something else, ctrl+shift+c was available.

[–] BaconIsAVeg 3 points 1 year ago

Yes this makes sense. I've been using terminals for years with the 'copy on highlight' feature enabled, and I'm pretty sure when I was on OSX it was a single buffer.

I can see how having mouse selected text end up in the buffer on a non-Terminal app would probably not be the desired behavior.

I found 'autocutsel' which will keep PRIMARY and CLIPBOARD in sync, however Gnome Terminal doesn't seem to support 'copy on highlight' while Terminator does.

[–] [email protected] 1 points 1 year ago

I have been using desktop Linux for years and never realized... thanks!

[–] [email protected] 1 points 1 year ago

A very comprehensive and complete reply. I did know about the different clip buffers but reading this was still so good because no one was actually explaining it. Thanks

[–] [email protected] 11 points 1 year ago
[–] ik5pvx 7 points 1 year ago

There are two copy/paste buffers. The one you get with just the mouse is not the same as the one you get with ctrl-c ctrl-v. And frankly, once you know this, it's f*ing awesome. If you really want a single buffer, there are apps that do that.

[–] [email protected] 6 points 1 year ago

I've only ever had this problem for the first few janky years of Wayland. Not anymore.

[–] cspiegel 6 points 1 year ago

Others have covered PRIMARY vs CLIPBOARD (the separation of which I find to be extremely useful).

For Vim, you have access to these both via the registers + (CLIPBOARD) and * (PRIMARY). So, for example, to paste from your CLIPBOARD selection, you'd do this:

"+p

(or P). Similar for yanking:

"+yy

for example.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago)

https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer

Your terminal is using the PRIMARY buffer whereas Chrome is using the CLIPBOARD buffer. As well, middle click in terminal pastes from the PRIMARY buffer. The terminal and vim can be configured to use the CLIPBOARD buffer instead, which will unify all of these. The configuration depends on which terminal you're using though.

There are really just the three buffers, PRIMARY, SECONDARY and CLIPBOARD (which is ironically most common) but it's confusing which programs use which buffers by default.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

Middle click in chrome...

If you want to use ctrl-v you need to the newer method of ctrl-shift-c first. It uses shift for the same reason windows does in a command prompt, ctrl-c is a reserved combination.

Not a Linux issue. Two different paradigms one older than the other, chose which is best to use.

On my laptop's I use ctrl-shift-c and ctrl-shift-v due to not having a middle click. With a mouse I middle click instinctively.

[–] ik5pvx 1 points 1 year ago (1 children)

You can set the touchpad to emulate third button by clicking left and right together. this setting is buried in the mouse configuration options and usually disabled by default.

[–] [email protected] 1 points 1 year ago

Yes I have used that in the past but it's way to finniky in operation as it sometimes registers a left or right click instead.

[–] Hildegarde 4 points 1 year ago (1 children)

I have an issue that clipboard content is application dependent.

So many times, I will open a program to find some text, Ctrl+C to add it to the clipboard, close that program because I'm done with it, switch to the second program, push Ctrl+V, nothing happens because closing the first program cleared the clipboard's content when closed.

Is this inherent to Linux, or could using something other than KDE fix it?

[–] colonial 2 points 1 year ago* (last edited 1 year ago)

I don't have any technical answers for you, but I'm on GNOME Wayland and I've never had any issues like that.

[–] [email protected] 3 points 1 year ago (1 children)

What I'd like to see is a clipboard history which pastes the content into cursor with just mouse click/enter.

[–] [email protected] 1 points 1 year ago

Clipboard indicator might be what you're looking for, unless I misunderstood your comment

[–] [email protected] 3 points 1 year ago

Have you tried another browser like Firefox? I’ve never had copy paste issues between any of my apps

[–] [email protected] 2 points 1 year ago

From what I understood is that the functionality that pastes selected text with middle-click is coded deep in the Linux kernel, so it doesn't even use a clipboard and it would be hard to get rid of this functionality. As others mentioned, using normal copy-paste commands (ctrl+shift+c) shouldn't be a problem because it uses a clipboard.

load more comments
view more: next ›