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.

  • kolorafa@lemmy.world
    link
    fedilink
    English
    arrow-up
    27
    ·
    edit-2
    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.worldOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      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
      link
      fedilink
      English
      arrow-up
      1
      ·
      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