jtheoof/swappy

swappy is not actually trying to use xclip?

mleue opened this issue · 4 comments

mleue commented

swappy version 1.5.1

Thanks for this awesome little tool. It is the sweet spot in terms of complexity/features for me.
I've been using it on wayland/sway for a while with no issues. Lately I've found myself on x11/i3 for various reasons and wanted to recreate my tooling around screenshots/screencapture.

I wasn't expecting swappy to work in x11 (since it brands itself as wayland-native), but most of it does apparently. The only thing that doesn't currently work is copying to clipboard.

Swappy complains that one of wl-copy, xclip or others needs to be installed. I do have xclip, but it still fails.

The responsible line in code seems to be here:

execlp("wl-copy", "wl-copy", "-t", "image/png", NULL);

As far as I can see, swappy warns that some clipboard utility must be present, but the only one it actually tries to use is wl-copy.

Am I right here? Could we alter the behaviour to actually try the alternatives as well?

Thanks in advance. :)

n3oney commented

As a workaround, you could just make a simple bash script that would route wl-copy to xclip

There is no standard way to access clipboard API in Linux as far as I know. And as you mentioned swappy is targeting wayland ecyosystem. So relying to external tool is not ideal but I don't see a better way at the moment. The workaround provided by @n3oney would do the trick I believe.

There is no standard way to access clipboard API in Linux as far as I know.

There is cb, maybe it would work?

Since this is marked as wontfix and xclip will not work, how about changing the warning on lines 37-38 from

"Unable to copy contents to clipboard. Please make sure you have "
"`wl-clipboard`, `xclip`, or `xsel` installed.");

to

"Unable to copy contents to clipboard. Please make sure you have "
"`wl-clipboard` installed.");