Live data from Hacker News

How the clipboard works

whynothugo.nl

11–20 of 160 posts

Re: How the clipboard works

#11

Good refresher, nice share. I wish there was a little more transparency in the clipboard. When I press WinKey+V, Windows 10 only shows me one format but often pastes a different one (obviously) -- would be nice to have the option to allow me to look into the possible formats I can get out.

> would be nice to have the option to allow me to look into the possible formats I can get out.

That would only confuse an average Joe so don't have high hopes.

IMMSMW there was a program what would show which formats are available for the current content, but hell if I remember how it was called and was it a regular program or just an exercise in Win32 API. Maybe it was in Raymond Chen's blog.

But if you are interested you can probably write it yourself.[0]

ADD: there is such a program on codeproject [1] but it requires a registration to download the binary, so I can't vouch for it.

[0] https://learn.microsoft.com/en-us/windows/win32/dataxchg/cli...

[1] https://www.codeproject.com/Articles/886711/Drag-Drop-Images...

Re: How the clipboard works

#12
Given how much memory we have available these days, would we build it the same way? Having copy paste usually work outta the box everywhere might be more valuable than memory savings.

Sidebar: I do at this point use a copy paste history app anyways that saves and plain text-ifies everything.

Re: How the clipboard works

#13

The "closing the app after copying and before pasting" case is very interesting. Shows how even things that sound simple turn out to have very tricky edge cases as soon as you start optimizing and really thinking about how to implement them. The clipboard manager solution seems okay, but copying everything immediately seems like it defeats a lot of the elegance of the design. Perhaps it'd be preferable if the origina…

On Windows, when you Copy the program supplying the data decides whether to send the data to the clipboard manager straight away, or whether to defer. If it defers, then yes it does a "last call" on closing. If it crashes you lose the clipboard.

Some programs will ask you when you quit them if you want to keep the clipboard contents, if you'd copied a large amount of data.

Re: How the clipboard works

#14
This design has the really annoying situation that applications closing down can't leave stuff in the clipboard. This results in a quite a frustrating behavior for users and also makes command line tools tricky. wl-clipboard lets you pipe text into the command to copy. The way it works is that it daemonizes in the background to fulfill the copy request. It either cancels on the first paste (command) or until some other application copies something into the clipboard. It's not completely awful design, but I'm surprised that the protocol does not offer at least the option to move content into the clipboard and exit.

Re: How the clipboard works

#15
Would love to see an analysis on mobile.

Android clipboard is broken. I paste out of date content into WhatsApp all the time (while other apps receive the updated 'copy' perfectly fine).

Re: How the clipboard works

#16
Might as well ask here.

On MacOS I have eight years of clips saved in a SQLite database created by Ondesoft's ClipBuddy. It is, by far, the best MacOS clipboard manager:

1. Unlimited clip storage, with no limit whether by time or space.

2. Search clips.

3. Paste without formatting from the keyboard.

4. Scroll up and down the history before pasting, again with the keyboard.

Ondesoft hasn't updated ClipBuddy in years, and each new MacOS version makes it creakier. It was broken on Monterey 12.5.1; with Monterey 12.6 it is mysteriously working again, but I know I can't depend on it forever.

I have tried ClipDrop, Clipy, CopyClip, Clips, ClipMenu, Jumpcut, and Qlipper, but nothing has all virtues. The closest I've found is Maccy; while limited to 999 clips, it supports 3 and I can partially replicate 4 with BetterTouchTool's help.[1] I would appreciate suggestions other alternatives, whether free or paid.

[1] Speaking of which, I've never been able to get BetterTouchTool's own clipboard manager to work.

Re: How the clipboard works

#17
For those wondering about how Windows does this, there is, as you'd expect, a Raymond Chen article about it: https://devblogs.microsoft.com/oldnewthing/20210526-00/?p=10... (and some more, like https://devblogs.microsoft.com/oldnewthing/20220608-00/?p=10...)

Elsewhere in these comments there is also a link to an explainer for the macOS equivalent.

Here's also an explainer for X11: https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTI...

It's interesting to look at these clipboard APIs together to see what may have led to the Wayland design, which is probably the most recently designed clipboard implementation.

I think the Wayland API is more elegant but also requires a clipboard manager in cases where you wouldn't expect to need tone (to copy less than a kilobyte of data before closing the program, for example).

Re: How the clipboard works

#18
No word about unix-style clipboard?

Select to copy, middle-click to paste. If I had to highlight an immediate usability advantage of linux with respect to windows and macos, it would be clearly this thing. It feels "at home" when you can do this.

Also, I have a viscerally strong disagreement with the following sentence:

> The majority of the implementations out there are broken and only handle text.

For me, one of the main uses of copy paste is to transform something to plain text. A clipboard implementation that pasted non-text things would be broken.

Re: How the clipboard works

#19

No word about unix-style clipboard? Select to copy, middle-click to paste. If I had to highlight an immediate usability advantage of linux with respect to windows and macos, it would be clearly this thing. It feels "at home" when you can do this. Also, I have a viscerally strong disagreement with the following sentence: > The majority of the implementations out there are broken and only handle text. For me, one of th…

Most people want to copy and paste files and images

Re: How the clipboard works

#20

No word about unix-style clipboard? Select to copy, middle-click to paste. If I had to highlight an immediate usability advantage of linux with respect to windows and macos, it would be clearly this thing. It feels "at home" when you can do this. Also, I have a viscerally strong disagreement with the following sentence: > The majority of the implementations out there are broken and only handle text. For me, one of th…

For a while a lot of distros started suppressing the Unix clipboard. Not sure if that's still a thing, but drove me crazy because it's just muscle memory for me now.
Post reply on HN