I cannot believe that in this the year of our lord 2025 we still have two separate clipboard buffers on desktop Linux.

There are very few cases where I will execute a paste (whether it is with middle click or Ctrl-V) and I will want the resulting paste to be anything other than the last thing I copied. Whatever X11 subcommittee came up with the idea that users would want to juggle stuff between the two buffers, or whatever the fuck the thinking was, needs to be punished physically. It’s not enough to tell them: They need to remember, so that they will know what they did was wrong, and get fearful in the future if they ever think of doing anything like that again. Their names should be made public, so that people in the future who might want to hire them will know what they did. (I tried to find out who it was, but Google is drunk again and couldn’t really tell me all that much.)

I am already aware that the X11 people spent a lot of time huffing glue in between creating overly complicated standards documents. So maybe the fact that they made some baffling and wrong decisions for literally no reason isn’t surprising. It was a long time ago, a lot of bad things happened back then. What I really cannot understand is why Wayland looked at that decision, and the long history of pain and suffering it had caused over the years, and decided, “You know what? Let’s keep that around. What harm could it do? And anyway… it’s compatible!”

Having two clipboards is literally just worse. Even if we go back to the pre-Wayland days, before the singular clipboard each app chooses to interact with became a mutually incompatible happenstance that depends on the toolkit and historical lineage of that particular tool, so that it’s often simply impossible to copy and paste between two extra tools before you do the standard ritual of installing some “make my clipboard work please” incantations into your system setup that don’t fully work but close enough to stop you complaining, it was still worse. Even back in the X11 days, when all the users just ignored the Ctrl-C clipboard and used the middle-click clipboard, it was still just extra work for no reason. Now, it’s become completely unforgivable. I want to take away these people’s car keys and replace them with a pair of identical keys and tell them that one or the other will randomly work, each morning, and they have to try it and find out, every time. I want to replace one of their morning yogurts with Elmer’s glue, and tell them they should install a Yogurt sync tool if they don’t want the glue, because it’s important to be kind and accommodating to the people who need glue in the morning and that’s what’s important right now.

If anyone knows of something I can run that will just do a simple bidirectional sync between the two clipboards, so I can just pretend to myself that all of this isn’t happening, please tell me. I tried to find a solution for half the morning so far, because I finally just got enraged by it, and I couldn’t find one.

If I imagine hard to myself, I can maybe imagine a scenario where I might want to hit Ctrl-C, then I would accidentally highlight something right after, and then I would want to paste the thing I did Ctrl-C for. But surely that use case isn’t the one that we need to wrap the whole desktop Linux clipboard situation around, to make sure that Fat-Finger Freddy can still get his pasting done, all while the rest of us have to go around saying things like “wl-paste -p -w ‘wl-copy’” and everyone has to do a bunch of extra work whenever they want to do the already difficult task of making pasting work in an editor over SSH or something.

I literally can’t believe how bad it is. It’s like a prank. It’s like one of those imaginary programming languages where someone invented a deliberately malicious feature and then implemented it to a T to be funny.

I do not like it. Not one bit.

Also: Did you know the are three clipboards? The third clipboard is called the “secondary selection,” in keeping with the impeccable human logic that runs all through the X11 codebase like cordyceps through a staggering, dying ant.

Emacs is only editor in history that does anything with the third clipboard. Hold down “alt” and drag with the left button to highlight something, and that thing will go into the special top secret clipboard, where nothing will ever see it.

OH HOW USEFUL

SAID NO ONE EVER

  • Björn Tantau@swg-empire.de
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    😁 You’re just too late to Wayland. That’s all. Wayland’s lack of primary selection support actually kept me away for years. I like having two clipboards. One with longer lived content and one for immediate use.

    Though I’ve now been disabled for quite a while and don’t use a mouse anymore. So I can’t see if there are any bugs.

    I recall reading some of the debates on how to specify the support in Wayland and I remember someone bringing up the possibility of having an unlimited number of clipboard and making it the compositor/clipboard manager’s responsibility of juggling that. No idea what became of that.

    • PhilipTheBucket@ponder.catOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      What’s the logic behind it being better to have multiple clipboards, as opposed to having a single clipboard with accessible history?

      I can kind of get how you might want to paste something from a longer-lived conceptual activity even if you highlighted something since then… but if you’re going to do the UI and API work to support multiple sources for the paste, why on earth should it be an arbitrary toolkit-driven decision, with no history, instead of a deliberate decision about which historical copy the user wants to paste out of all the recent copies? What advantage is gained by segregating into separate “clipboards” when we know that the great majority of apps are going to just pick one that’s their favorite and interact with only that one?

  • PhilipTheBucket@ponder.catOP
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    Okay, if anyone is curious: I finally lost so much patience with all of this that I fought with it until it was actually doing what I want. It took far longer than it should have.

    Here was the secret sauce, for my setup at least:

    Wayland needs running in the background:

    wl-paste -w sh -c 'wl-copy -p'
    

    So what that does is send anything from CLIPBOARD to PRIMARY, so I can click “copy to clipboard” on a web page and still middle-click to paste it. I actually don’t care as much about the other way (which is good because it seems like it might cause an infinite loop); @Riskable@programming.dev you can rest easy that the Ctrl-V buffer won’t be affected by highlighting text and I can still do paste of whatever I wanted to, even if I highlighted in the middle.

    Then in Helix config on any remote machine, have:

    [editor]
    clipboard-provider = "termcode"
    

    That’s what enables us to highlight text in Helix and have it make it back to the local system’s clipboard. I actually don’t know which clipboard it’s going into there, and thanks to wl-paste, I don’t have to care.

    Then, in kitty config on the local system, have:

    mouse_map middle press ungrabbed paste_from_selection
    mouse_map middle press grabbed paste_from_selection
    mouse_map middle release ungrabbed discard_event
    mouse_map middle release grabbed discard_event
    

    That means that we disable all efforts which Helix will make to grab the middle-click event and fuck it up in some way or other. Kitty pastes the text, Helix receives it, and we have the nice side benefit that it goes in where the cursor is instead of at whatever random position I have let the pointer wander over to before I did the middle click.

    Hallelujah. I can get back to actual work. Boy this wasn’t a big extensive confusing waste of time involving extra difficulty that didn’t need to be there. Great. Great.

  • nesc@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    1
    ·
    29 days ago

    I love that there is multiple clipboards, Primary is one of the best things ever. It’s super useful, I often select text in browser while reading and don’t need it in my clipboard, but when there is something interesting copied text is just one click away. Actually I would love a configurable number of clipboards, 5 would be great.

    As foryour frustration you can use clipboard manager (iirc klipper on kde syncs them by default but you can disable or enable primary there).

    • PhilipTheBucket@ponder.catOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      29 days ago

      iirc klipper on kde syncs them by default

      I wonder why that is lol

      I solved my problem already; wl-paste was able to set up a situation that’s pretty acceptable to me (which, BTW, actually will preserve your ability to highlight text and then paste something from CLIPBOARD into something else if you want to). Helix over ssh still can only manage to yank text into one of the clipboards, and not the other, but I have invested enough of my free time into this problem at this point and don’t really want to delve into the reasons for that any further since I have a workflow that semi-works and whatever it’s fine.

      Like I said in one of the other comments, adding the ability to paste text from any of the last N copies would solve your problem as well as many others, and it would also degrade gracefully into acceptable behavior instead of degrading into inability to copy-paste as the current system does. I’ve already solved my problem so I am fine, but I still refuse to accept on any level that this was the right way to structure things.

      • nesc@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        1
        ·
        29 days ago

        Ability to paste text from last n copies is also built-in in every clipboard manager, for kde klipper history is mapped to win+v, for others I don’t know.

        Ability to sync clipboard over ssh that will support other applications is a neat thing to have, true.

  • Riskable@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    Just use KDE and you get klipper which is an amazing clipboard manager. It keeps track of everything you’ve copied to your clipboard (raise the history to 999).

    Configure it to pop up at the cursor location and whenever you type the keystroke you’ll have access to everything.

    I personally prefer that it not paste immediately upon selection but there’s a number of options like that to set it up to your liking.

    • PhilipTheBucket@ponder.catOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      Just use KDE

      Gonna stop you right there 🙂

      and you get klipper which is an amazing clipboard manager

      Does it sync the select/middle-click clipboard with the Ctrl-C/Ctrl-V clipboard? I do like having both, especially since some tools will only be able to conveniently interact with one or another, it just drives me nuts that they are separate entities. Having a clipboard manager with history is a neat thing but not as essential to me as just having the nuts and bolts working.

      I can literally provide you a simple example: Go to https://emojipedia.org/slightly-smiling-face, click “copy”, and then come back and middle click in the reply. Do you get a smiling emoji? If you select some text in the reply and then hit Ctrl-V, do you then get the text you highlighted?