11
submitted 1 year ago by BaconIsAVeg@lemmy.world to c/linux@lemmy.ml

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.

you are viewing a single comment's thread
view the rest of the comments
[-] kolorafa@lemmy.world 27 points 1 year ago* (last edited 1 year ago)

@BaconIsAVeg@lemmy.world

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@lemmy.world 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.

[-] DamnOrangeCat@lemmy.ml 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

[-] what@discuss.tchncs.de 1 points 1 year ago

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

this post was submitted on 06 Jul 2023
11 points (61.7% liked)

Linux

48714 readers
1338 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