aweinstock314 / rust-clipboard

System Clipboard interfacing library in Rust
Apache License 2.0
368 stars 75 forks source link

Binary clipboard #46

Open anna-is-cute opened 6 years ago

anna-is-cute commented 6 years ago

Being able to read the clipboard as a vector or slice of u8s would be extremely useful to anyone who needs to work with the clipboard not just with strings.

I know this is feasible in Windows, and I think it can be done in macOS (from what I read of the current implementation), but I don't know about in X11.

aweinstock314 commented 6 years ago

I agree that this would be a useful feature. I'm willing to accept a PR that adds support for the platforms that you're willing to implement it for, and I'll add support for the rest of the platforms (it should be feasible under X11 too).

NomadMaker commented 6 years ago

Has there been any progress on this?

I am willing to work on an X11 version. I am sure that it can be done because I have written a Java application which copies images from the system clipboard from a different graphics application under Linux. I think that is a proof of concept, at least.

Multiple things can be in the clipboard at the same time, which might require changes to your elegant clipboard.

rickycodes commented 6 years ago

I am also looking for this functionality... Got a panic when calling Result::unwrap() on ctx.get_contents() when trying to read image data:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: StringError("pasteboard#readObjectsForClasses:options: returned empty")', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
leiserfg commented 5 years ago

Check this https://github.com/SpiralP/rust-clip-sys