bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

wl-copy --paste-once doesn't work at all #127

Closed Zeioth closed 2 years ago

Zeioth commented 2 years ago

This command does nothing

echo test | wl-copy --paste-once
wl-paste

This one works fine

echo test | wl-copy
wl-paste

Tested arch packages wl-clipboard and wl-clipboard-git.

YaLTeR commented 2 years ago

Works fine here:

┌ ~
└─ echo test | wl-copy --paste-once
┌ ~
└─ wl-paste
test

Are you sure you don't have some clipboard manager or similar interfering?

maximbaz commented 2 years ago

Hi, to merge this thread with the archlinux bug you created, is there anything that needs to be done? I dont seem to reproduce the issue on the released version.

Zeioth commented 2 years ago

These are my packages. I removed cliphist, which look like the only thing that could interfere, but wl-paste still returns No selection if used after wl-copy --paste-once.

example.txt

maximbaz commented 2 years ago

In the arch bug you mentioned that -git works well for you and the problem is only with latest release, and in this ticket it seems -git doesn't work either. Could you confirm which is the actual behavior?

Zeioth commented 2 years ago

Hello @maximbaz , I though so, but doesn't seem to be the case. Please downgrade the severity of the issue to low while I research further.

Zeioth commented 2 years ago

Ok manjaro-sway main dev told me about the command

ps -ef | grep wl-paste

And it showed that even though I uninstalled cliphist and ran kill -9, itwas still running on background. After rebooting, wl-copy --paste-once works fine.

But the question remains... It is really safe to have an option that interferes with the clipboard historial? That's gonna cause a lot of problems between developers using --paste-once and users running clipboard history managers.

What's your position on this? There is some other historial tool that you recommend? I ocassionally contribute to manjaro-sway, and I would like to know how to proceed.

Cheers.

YaLTeR commented 2 years ago

I'm afraid this is once again a problem with the particular clipboard manager you're using. For example, Mutter's built-in clipboard manager doesn't mind at all:

┌ ~
└─ echo test | wl-copy --paste-once
┌ ~
└─ wl-paste
test

┌ ~
└─ wl-paste
test
Zeioth commented 2 years ago

Thank you for your answer @YaLTeR. Would you recommend a clipboard that can be installed from arch/aur? (I think mutter intregrates most of its stuff). If not, it's ok, you already helped me a lot with that.

EDIT: Actually, I'm gonna report the issue to cliphist.

YaLTeR commented 2 years ago

Unfortunately I'm not familiar with clipboard managers and can't help, sorry. :/

I suppose this issue can be closed then?

Zeioth commented 2 years ago

clipboard-hist developer suggests that could be an issue with wl-paste --watch and wl-copy --paste-once

https://github.com/sentriz/cliphist/issues/25#issuecomment-1030877540

It look like a bug. It messes with all clipboard history managers. Would be a good idea to get a look into it.

YaLTeR commented 2 years ago

It's not a bug. --paste-once only allows for a single fetch of the clipboard contents, and wl-paste --watch does that single fetch of the clipboard contents.

Zeioth commented 2 years ago

Got it thanks!

I still don't totally understand the case of use of --paste-once. In practice, for distros with clipboard, it means: Copy directly to the clipboard (without possibility of copying directly).

I guess if the clipboard is protected by password that's more... secure?

maximbaz commented 2 years ago

Well you probably don't want sensitive stuff to end up in the history of your clipboard manager, so you could for example consider:

sentriz commented 2 years ago

ah that reminds me, I was stalking @kkga 's dotfiles and saw he has a solution to this with cliphist 😁

https://github.com/kkga/config/blob/4567b4a6d9ab6bdf72d5c2ab034a7e043aa8bab1/.local/libexec/clipboard-skip-or-store