Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with images #1

Closed
BanchouBoo opened this issue Jan 29, 2023 · 7 comments
Closed

Doesn't work with images #1

BanchouBoo opened this issue Jan 29, 2023 · 7 comments

Comments

@BanchouBoo
Copy link

When copying images, they get stored as plain text so you can't for example copy a screenshot then paste it into an image editor.

@phillbush
Copy link
Owner

I can copy from Firefox into GIMP with no problems.
I faced a problem, however, on X11 clients that do not support the MULTIPLE target, like xclip (xclipd needs that the clipboard source supports the MULTIPLE target).

What are the clipboard source application (the one you Ctrl-C) and the clipboard destination application (the one you Ctrl-V)?

@BanchouBoo
Copy link
Author

Using xclip with the image/png target to copy, pasting into Discord and GIMP both did not work.

@phillbush
Copy link
Owner

Yeah, as I supposed: xclip.
It lacks support for the MULTIPLE target.
There's an issue there for that.

If copying images works between other applications (say from Firefox to GIMP) but not from xclip, then that's not a bug on xclipd side, but on xclip's. (Although they are named alike, those projects are not related).

I can make a workaround for clients that does not support the MULTIPLE target, but that's a hack. The optimal solution is to all X11 clients engaging into the clipboard selection mechanism to implement the ICCCM selection protocol.

@BanchouBoo
Copy link
Author

Copying does work between applications, guess I'll close this then. Any recommendations for an xclip alternative?

phillbush added a commit that referenced this issue Jan 30, 2023
Most applications support various targets.

For example, when copying rich text into the clipboard (ie', text with
bold or italic content, etc) from a web browser, the browser can convert
the clipboard content into at least two targets: rich text, with all the
formating (to paste into LibreOffice, for example); and plain text, with
no formating at all (to paste into a text editor, for example).

The same goes for image editors.  GIMP can covert its copied images into
`image/png`, `image/jpeg`, etc.

When our clipboard manager asks the content of the clipboard, it calls
the `savetargets()` function, which asks the original clipboard owner to
convert various targets at once (using the `MULTIPLE` special target).

A few applications, however, only know a simgle target, and then doesn't
even deal the `MULTIPLE` special target.

This commit makes `xclipd` ask directly for the conversion of the single
target known by the original clipboard owner, rather than asking for it
through a `MULTIPLE` special target.
@phillbush
Copy link
Owner

Copying does work between applications, guess I'll close this then. Any recommendations for an xclip alternative?

The only X11 clients that work as source and destination for the clipboard are xclip and xsel.
xsel, however, seems to not support targets provided by the user.

I want to expand xclipd in the future with two more commands, one for writing into the clipboard, and the other for reading from the clipboard, thus providing replacements for xclip -in and xclip -out. Those commands will implement the full ICCCM specification, and thus work with other programs.

However, I have implemented into xclipd a solution to work with xclip and other clients which do not fully implement the ICCCM specification. More information in the commit message.

@BanchouBoo
Copy link
Author

Works now, thanks!

@phillbush
Copy link
Owner

Hi, xclipd is now included with a few other utilities, two of which, xclipin and xclipout can replace xclip -in and xclip -out commands.
xclipd still works with not fully ICCCM-compliant applications such as xclip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants