News for hackers. Stuff that matters.
Re:How the Clipboard Works by bowsamic on Tuesday October 25, 2022 @04:01AM (#33327536)
Most people want to copy and paste files and images
Re:How the Clipboard Works by enriquto on Tuesday October 25, 2022 @04:11AM (#33327612)
I understand this concern. But it seems that it would be better to have an orthogonal implementation of this. The clipboard remains text-only. If you select an image or a file, it copies its absolute path (or url) into the clipboard. Then it is the responsibility of the destination program to interpret what to do with this text. If you paste the filename of an image into a plain text editor, you'll get the filename verbatim. If you paste it into an image editor, it opens and pastes the image in there. But from the point of view of the clipboard it's always just text (maybe with some textual markers).
Re:How the Clipboard Works by jakub_jo on Tuesday October 25, 2022 @04:23AM (#33327717)
Or better: The data URI gets copied.
Re:How the Clipboard Works by ubercow13 on Tuesday October 25, 2022 @04:53AM (#33327949)
But I already downloaded the image, I don't want to download it again. What if I want to copy a subsection of an image from an image editor, there is no textual representation as it is not a file on disk.
Re:How the Clipboard Works by NavinF on Tuesday October 25, 2022 @06:40AM (#33328713)
That breaks common use cases such as copy-pasting private images that can only be downloaded using your login cookies.

> If you paste the filename of an image into a plain text editor, you'll get the filename verbatim. If you paste it into an image editor, it opens and pastes the image in there

That's how the clipboard already works on Windows as long as the source application provides both formats.

Re:How the Clipboard Works by londons_explore on Tuesday October 25, 2022 @04:12AM (#33327617)
I find the clipboard increasingly broken for this usecase...

Imagine I want to copy an image from a webpage into an email... And then the paste fails because the email client tries to download the image but doesn't have the correct cookies and fails...

Or I want to copy a file from Google drive onto a USB. But when you copy from the Google drive webUI it just copies the name of the file, not the file itself...

Or I copy an image from Google images and the thumbnail low Res version is copied rather than the full res version.

Copy and paste, and drag and drop, seem to be neglected on the web.

Re:How the Clipboard Works by aasasd on Tuesday October 25, 2022 @04:32AM (#33327791)
> I want to copy an image from a webpage into an email... And then the paste fails because the email client tries to download the image.

Personally I haven't had this problem: just like the article says, the browser ‘copies’ image data with a correct mime-type, and the other app pastes the image if it knows about that mime-type. This is on MacOS, with Firefox.

(Though, again personally, I now usually scale the image and convert to webp before sending in a chat—I don't do much email. This way I'm avoiding 4K 4MB pics. I'm probably gonna make me a browser extension to do this automatically.)

Re:How the Clipboard Works by Tistron on Tuesday October 25, 2022 @06:40AM (#33328710)
I often find myself taking screenshots of pictures for that reason. It's not webp, but also not 4k.
Re:How the Clipboard Works by 867-5309 on Tuesday October 25, 2022 @04:14AM (#33327631)
those are limitations of the browser, not the OS
Re:How the Clipboard Works by londons_explore on Tuesday October 25, 2022 @04:15AM (#33327652)
But the user doesn't care whose fault it is. The end result is they get a poor and frustrating experience.
Re:How the Clipboard Works by johnchristopher on Tuesday October 25, 2022 @04:22AM (#33327714)
It's the user's fault, though.

If they don't understand the difference between copy pasting HTML with an image inside the tag soup (select with mouse a bunch of text and image and right click copy) and an image (hover image and right click "copy image") then there's not much anybody can do.

Do you want clippy in the browser "looks like you are trying to copy an image" ?