-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inject UTF-8 text #1426
Inject UTF-8 text #1426
Conversation
Only the main injection method was exposed on Device, the convenience methods were implemented in Controller. For consistency, move them all to the Device class.
Expose methods to inject key events and key codes with an additional parameter to specify the "mode" (async, wait for finish, wait for result).
On Android >= 7, inject text using the clipboard. This is faster and allows to inject UTF-8.
Where can I download it? |
I updated the post to include links to binaries. |
Doesn't work well. Example: Not only that, but for some reason it doesn't work on all places. In the create-contact screen, it didn't work for some of the EditTexts... And for some reason I can't run it without the console using "scrcpy-noconsole.exe" . See here: |
What behavior do you get on v1.13? What if you launch it with
Oh, that's bad :(
This is not a release, just a quick build so that you can test, I didn't post a new build of |
By "v1.13", you mean the official one here: Using I still don't get how come the EditText issue exists. I can paste there... |
OK, thank you for your feedbacks. This method could not be used when typing text then. However, I could probably use it to paste the text immediately on |
Can you please explain how could the EditText issue exist ? Pasting is allowed there... Is it possible perhaps to create a (secured) app that uses root, to type characters via ScrCpy? |
I don't know.
Scrcpy should work without root. And indeed it looks dangerous. |
I'm talking only about the non-English typing. I don't think there is any other solution, sadly. Someone proposed a keyboard, but that's changing the way we use the device and it doesn't seem like a stable solution. I already requested Google to add unicode support: It doesn't even work for emulator: But I don't think it's going to be added anytime soon. |
@rom1v so could you investigate the work around based on their implementation? |
@quyleanh Do you know perhaps of a different alternative to it, that does offer unicode? |
@AndroidDeveloperLB no, I don't. I have tested QtScrcpy but it doesn't support unicode. (of course, it's based on scrcpy). Hope @rom1v can find out the way. |
@rom1v I hope you sue them for violating. |
mirroid真强大,是我需要的 |
can you add built linux binaries of this in here? my distro seems to have problems with meson as it provides only 0.45 and scrcpy needs 0.48 to be built |
Version from top post works for me like a charm. Polish characters are handled well. Thank you! |
if check the message is utf8 char use paste?or not use ascii inject。maybe is a idea but i need check all char |
I adapted this a bit in my fork and works great for my needs. |
@AlexBurdu could you add some brief info? |
So the implementation that you can see in my fork, which is a slightly modified version of the one in this PR works fine on my Pixel phone. Unfortunately it does not work well on my Samsung Galaxy S20 FE. I initially started poking at this to add Romanian diacritics support, but it seems that support for them is missing in the Android OS |
@rom1v would it be possible for scrcpy server to register an IME that would take care of text input, or is not possible? Note: I have read DEVELOP.md, but it's still not clear to me and I'd like to contribute to this. |
No, it's not an Android app, just a Java executable accessing the Android APIs. More details: https://blog.rom1v.com/2018/03/introducing-scrcpy/ About IME, also see #1751. |
Thanks, the hack in #1751 is what I needed as a fallback to key inject! |
@AlexBurdu could you please give me the Windows build for your latest implementation? I would like to test with my inject text scenario. |
@quyleanh Here. |
Thanks, I just adapted the work others have done in the linked PRs. Also, i have a few changes done to the mouse buttons bindings on my fork. |
For Linux/Mac users, I use this trick to get the ADBKeyBoard set when I start scrcpy and then switch back to my previous one (GBoard) when I exit it. Should be easy to adapt it for Windows also.
|
since i for can not submit issues on your fork built by @domenn, i'll put it right here. for whatever reason, on non-english layout, when pressing a russian key, both english and russian chars appear at the same time. this might be my clipboard manager or kde connect freaking out but they seem to copy only russian chars. my devices are: redmi note 9s running pixelplusui on android 11 and a laptop running windows 10 21H1 x64, connection was done with usb, commandline is upd. seems fine with upd2. i also get a system accent colored screen if i start your build with -f to make it fullscreen by default |
that sounds like a bug for https://github.com/senzhk/ADBKeyBoard, but I'm not sure. |
@domenn @AlexBurdu thank you very much. I have tried and it work well with my case. How can I disable inject with clipboard? I would like to use only with ADBKeyBoard. |
We have diverged a lot from the initial PR discussion (sorry for that). in my fork, I don't have any code left for injecting through clipboard. |
How to use your fork? I have just compiled your fork and launched it but I still cannot type Chinese character. I have the ADB keyboard app installed. |
I have compiled the Windows builds with @AlexBurdu 's ADBKeyBoard merged. |
see #37 (comment) for probable solution |
Since Android 7, we could use the PASTE keycode to inject UTF-8 text, instead of injecting every ASCII char sequentially. (ref: #786 (comment))
So I just implemented it.
If the device runs Android >= 7:
It is very fast and allows to inject UTF-8 text, which is awesome for non-ASCII languages like Chinese.
Please test and report any problem.
Thank you for your feedbacks.
Here are binaries so that you can test even if you don't know how to build:
scrcpy.exe
SHA256: 4481d854630aaba9f31e4f3a19b46c4843c1918da03e1a486089bae3a3ebb09a
scrcpy-server
SHA256: 64cd4d4277040430c48d35677ad8472a6315337651fb9cfc5f62cf5abf2021b7
(on Windows, replace both files in the v1.13 release; on other platforms, use
scrcpy-server
and follow §Prebuilt server)