copypasta icon indicating copy to clipboard operation
copypasta copied to clipboard

Android support

Open mks-h opened this issue 3 years ago • 6 comments

Hi! I see two possible uses of this library on Android:

  • By some JVM apps, through their own rust library (e.g. game engines)
  • By cross-platform term apps, through Termux (e.g. jmacdonald/amp)

The latter probably can be done by simply running process 'termux-clipboard-get/set'. About the first case — there is an easy way in SDK to use the clipboard, however, it needs to be used through JNI. This crate is used by Servo among others, so I think it'll be fine to use.

Things to think about:

  • [ ] Can the Termux case be covered by the JNI thing?
  • [ ] How to handle different Android SDKs?
  • [ ] How to test?

mks-h avatar Aug 29 '21 04:08 mks-h

~~There's currently no plans to support any other platform.~~

I'm sorry, I was thinking this was opened against the Alacritty terminal emulator. Copypasta can certainly look into supporting Android, though it's likely nothing official maintainers are going to sink significant time into.

chrisduerr avatar Aug 29 '21 14:08 chrisduerr

I have implemented Android support and opened a pull request to https://github.com/aweinstock314/rust-clipboard, but nobody respond. Please take a look at my fork: https://github.com/Fancyflame/rust-clipboard. I'm glad to open a pull request to this repository if needs.

Have tested on my physical phone (winit). NDK: r22b platform: Android 10 SDK: (I forgot, should be the latest)

Fancyflame avatar May 01 '22 18:05 Fancyflame

@Fancyflame If you check the readme of this repo, you'll come to realize this is also a rust-clipboard fork since they didn't merge our Wayland support PR.

Your android implementation seems pretty reasonable, are you interested in sending a PR?

chrisduerr avatar May 01 '22 18:05 chrisduerr

@chrisduerr Of course. Please wait a moment.

Fancyflame avatar May 01 '22 18:05 Fancyflame

@chrisduerr I'm sorry but I found it's little difficult for me to operating this on my phone. copypasta is not completely the same as clipboard so, it may needs some extra modification. Would you mind I open PR tomorrow, when I could get my laptop? It's near 3 a.m. in China. XD

Fancyflame avatar May 01 '22 18:05 Fancyflame

No worries, take all the time you need.

chrisduerr avatar May 01 '22 20:05 chrisduerr