Skip to content

Conversation

@jb55
Copy link

@jb55 jb55 commented Jun 16, 2025

This is a rebase and rework of:

I had to update a few dependencies so that jni's window-sys wouldn't conflict, but after I did that the CI seems to pass.

I also fixed an issue where paste wasn't working in the original PR

Here's a video of it working in my egui android app:

arboard-paste.mp4

jb55 and others added 6 commits June 14, 2025 10:40
We needed to use a github version for jni due to
windows-sys build incompatibilities
Signed-off-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
Introduce Android-specific clipboard support using JNI and the
`ndk_context` crate.  This adds `Clipboard`, `Get`, `Set`, and `Clear`
types under `src/platform/android.rs` to interact with the Android system
clipboard, supporting basic text operations.

Non-supported operations (HTML, image) return `ClipboardNotSupported`
errors.  Conditional compilation gates are updated to exclude Android
from Unix-like assumptions (e.g., ScopeGuard, private sealing traits).

Signed-off-by: Piotr Podusowski <podusowski@gmail.com>
@complexspaces
Copy link
Member

Hey there, thanks for rebasing and cleaning up the prior PR. Please see my comment on the original PR and #191. I'd appreciate any feedback on the proposal since it affects Android.

The proposal will need implemented, in some shape, before I review this entirely though, sorry.

Comment on lines +96 to +97
# latest crate-compatible version of jni is not on crates.io, update this when it is
jni = { git = "https://github.com/jni-rs/jni-rs", rev = "1a4a345b1e65aca405e856046ff2661d37edde6d" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what to do about this off the top of my head. When you say "crate compatible" do you mean that Cargo won't build Windows or Android when jni brings in windows-sys 0.48 because of the range restriction earlier in this file?

Off the top of my head, I wonder if its feasible/possible to expand the version range here to support 0.48 too with more internal resolution workarounds...

Copy link
Author

@jb55 jb55 Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with the version on crates.io and I was getting tons of windows-sys conflicting errors on CI. switching to master on jni fixed it.

I found this related issue:

@complexspaces complexspaces added enhancement New feature or request O-Android Work related to an Android-supported clipboard implementation waiting on review The change is currently waiting on an arboard maintainer for a review or larger-scale update labels Jun 18, 2025
@jb55
Copy link
Author

jb55 commented Jun 23, 2025

Hey there, thanks for rebasing and cleaning up the prior PR. Please see my comment on the original PR and #191. I'd appreciate any feedback on the proposal since it affects Android.

The proposal will need implemented, in some shape, before I review this entirely though, sorry.

yeah no worries at all, I'm happy with maintaining a fork. I just needed this for my egui android app and maybe some others will find it useful as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request O-Android Work related to an Android-supported clipboard implementation waiting on review The change is currently waiting on an arboard maintainer for a review or larger-scale update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants