You are not logged in.

#1 Today 01:04:43

dino-ww
Member
Registered: 2026-11-06
Posts: 1

[SOLVED] Pasting images from a clipboard

I got surprised the other day that on my arch install without a clipboard manager, pressing "copy image" in a browser, and Ctrl+v in another application for which it makes sense to accept image input (Signal chat) works. Pasting an "image" into vim gives some html-like tags, but copying them in text form and pasting again into Signal just pastes raw text.
So I read about clipboards on the wiki and freedesktop.org (https://specifications.freedesktop.org/ … rd/latest/). But it did not mention anything about images. My thinking is there must be a way in which the browser communicates to Signal that the contents of the selection is an image. A content-type attribute passed somewhere. Maybe in another named selection?

Can anyone point me to some resources about this?

Last edited by dino-ww (Today 11:24:53)

Offline

#2 Today 05:21:18

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 838

Re: [SOLVED] Pasting images from a clipboard

Wayland or X11?

dino-ww wrote:

Pasting an "image" into vim gives some html-like tags, but copying them in text form and pasting again into Signal just pastes raw text.

Since terminal emulator running vim doesn't accept image, clipboard content "converted" into raw text before it is pasted into vim. Html-like tag is not a metadata for image but fallback option.

Offline

#3 Today 08:45:10

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,798

Re: [SOLVED] Pasting images from a clipboard

The CLIPBOARD buffer supports multipart data, the receiving client will filter the list for supported formats.
The protocol (on X11) exists between the two involved clients (no manager is necessary) and as @dimich pointed out, the image part isn't useful to vim and from there you simply copied some plain text.

This isn't even limited to images, you might see conversions between urls and paths (which are both technically text), audio files will likewise be affected as images… and actually nothing would prevent a client from converting a path or url into an image (eg. when pasting paths to gimp, while it does NOT act this way, it could try to load the image instead)

A clipboard manager *might* preserve all parts (for a while, images would eat up RAM fast) but you'd still have to load the relevant entry as current item there first.

Online

Board footer

Powered by FluxBB