Beastwick18/nyaa

clipboard not working

Closed this issue · 5 comments

maop commented

Hello, awesome project!

I'm trying out the binary nyaa-0.9.0-x86_64-unknown-linux-gnu but i can't make work the copy magnet to clipboard option (ym)
When i do with:

[clipboard]
x11_selection = "Primary"

it does nothing, with "Clipboard" my x11 clipboard gets erased but nothing is copied into it

then i tried with:

[clipboard]
cmd = 'echo "{content}"|xclip -selection clipboard'

and when i press ym the url gets copied into the clipboard (i can paste it to other windows) but then nyaa freezes and i have to kill it, i also try adding shell_cmd = "bash -c" and still same result

I'm on void linux, kernel 6.6.32, xorg 21.1.13, xfce 4.18 , please let me know if you need any more information

Looks like an issue with a dependency, quininer/x11-clipboard#32, which cli-clipboard depends on. I'll try and see if there's a workaround or if I just need to revert to an earlier version of cli-clipboard

Ok, so I think I've figured it out. Unfortunately, the bug arose withing some large range of versions of x11_clipboard. Somewhere between v0.3 and v0.7 I think. The crate rust-clipboard uses v0.3 and works fine on x11, which is why I think the bug happened in that range.

Fortunately, it's almost a drop-in replacement to cli-clipboard, except without Wayland support. cli-clipboard uses wl-clipboard-rs for Wayland, so I'll try and use that to replace that missing functionality.

This might also come with the bonus feature of selecting between Primary/Clipboard selection on Wayland too, since wl-clipboard-rs can check if the Primary selection exists.

I've gotten something working for now. Turns out most of the clipboard crates I've been using or could potentially use are all hardly maintained or have unacceptable issues. The main branch should now have a working clipboard solution, though. If you want to use it before the next release, you can install from source:

cargo install --git https://github.com/Beastwick18/nyaa

I'll leave this open and come back to this. I'm going to write my own clipboard solution that will hopefully not be as unreliable. By doing this, I'll also get around the problem of clipboard contents clearing after the process exits. And I'm not sure why the tests are failing 🙃. Tests and builds compile fine on my system.

Ok, everything should actually be good now with commit ff104ae. I'll close this since the main issue has been addressed. However, if you find it's still not working we can re-open this issue. I'll still be working to improve the clipboard.

v0.9.1 should also be out soon to address this and improve nix support. In the meantime, you can build from source to get around the issue for now.

maop commented

Amazing!

I installed with the cargo command you provided and can confirm it is resolved now.

Ty very much!