Skip to content
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

copy paste from pc to device is not working #1750

Closed
2 tasks done
kingk110 opened this issue Sep 10, 2020 · 10 comments
Closed
2 tasks done

copy paste from pc to device is not working #1750

kingk110 opened this issue Sep 10, 2020 · 10 comments

Comments

@kingk110
Copy link

kingk110 commented Sep 10, 2020

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: win10
  • scrcpy version: 1.16
  • installation method: Windows release
  • device model: samsung s7 edge
  • Android version: 8

I am trying to copy paste from the pc to the device but it working only with MOD+Shift+v which sometimes take long time and is limited to 300 characters as I noticed. the copy from the device to PC is working well. When I was writing the bug I noticed that MOD+v is working on chrome app on android but on whatsapp or memo or other app will not work. what could be the reason?

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2020

When I was writing the bug I noticed that MOD+v is working on chrome app on android but on whatsapp or memo or other app will not work. what could be the reason?

MOD+v just inject the keycode PASTE. You can reproduce manually with:

adb shell input keyevent PASTE

If it does not work on some apps with that key (once you copied some text on the device), then it is not handled correctly by the device or app.

Did you try Ctrl+v?

https://github.com/Genymobile/scrcpy#copy-paste

@kingk110
Copy link
Author

kingk110 commented Sep 10, 2020

When I was writing the bug I noticed that MOD+v is working on chrome app on android but on whatsapp or memo or other app will not work. what could be the reason?

MOD+v just inject the keycode PASTE. You can reproduce manually with:

adb shell input keyevent PASTE

If it does not work on some apps with that key (once you copied some text on the device), then it is not handled correctly by the device or app.

Did you try Ctrl+v?

https://github.com/Genymobile/scrcpy#copy-paste

Yes the Ctrl+v will always paste what is in the device clipboard and not what was copied from the pc. is there some shortcut to force sync the new copied text on pc to the android clipboard. because I also noticed that when you are typing in chrome the show clipboard option is disabled and if you use Ctrl+c Ctrl+v it will work with no problems.

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2020

Yes the Ctrl+v will always paste what is in the device clipboard and not what was copied from the pc

In theory, pressing Ctrl+v first synchronizes the computer clipboard to the device clipboard: 7683be8

So it seems that for some reason setting the device clipboard is "broken" on your device.

Is your device rooted? See #1678

@kingk110
Copy link
Author

kingk110 commented Sep 10, 2020

In theory, pressing Ctrl+v first synchronizes the computer clipboard to the device clipboard

you mean it should show something in the adb window that text was copied or something like

INFO: Device clipboard copied

that i ma getting when I copy from device

Is your device rooted? See #1678

no my device is not rooted

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2020

you mean it should show something in the adb window that text was copied or something like

INFO: Device clipboard copied

Yes, exactly:

INFO: Device clipboard set

boolean ok = device.setClipboardText(text);
if (ok) {
Ln.i("Device clipboard set");
}

@kingk110
Copy link
Author

you mean it should show something in the adb window that text was copied or something like

INFO: Device clipboard copied

Yes, exactly:

INFO: Device clipboard set

boolean ok = device.setClipboardText(text);
if (ok) {
Ln.i("Device clipboard set");
}

but when I am pressing ctrl+c on the pc no info is shown on the adb window.

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2020

but when I am pressing ctrl+c on the pc no info is shown on the adb window.

That's expected (although confusing).

Ctrl+c is injected to the device, as Ctrl and c, scrcpy has "no idea" that it will copy (sometimes, for example in Termux, it does something else). It's the system/app which decide what to do on this key combination.

rom1v added a commit that referenced this issue Oct 6, 2020
Some devices do not behave as expected when setting the device clipboard
programmatically.

Add an option --legacy-paste to change the behavior of Ctrl+v and MOD+v
so that they inject the computer clipboard text as a sequence of key
events (the same way as MOD+Shift+v).

Fixes #1750 <#1750>
Fixes #1771 <#1771>
@rom1v
Copy link
Collaborator

rom1v commented Oct 14, 2020

#1771 (comment)

rom1v added a commit that referenced this issue Nov 7, 2020
Some devices do not behave as expected when setting the device clipboard
programmatically.

Add an option --legacy-paste to change the behavior of Ctrl+v and MOD+v
so that they inject the computer clipboard text as a sequence of key
events (the same way as MOD+Shift+v).

Fixes #1750 <#1750>
Fixes #1771 <#1771>
@rom1v
Copy link
Collaborator

rom1v commented Nov 7, 2020

--legacy-paste option merged into dev: d5f059c

@rom1v rom1v closed this as completed Nov 7, 2020
jellopuddingstick added a commit to jellopuddingstick/scrcpy that referenced this issue Jan 23, 2021
scrcpy v1.17

Changes since v1.16:
 - Fix errors on Android 11 (Genymobile#1468)
 - Add --encoder option (Genymobile#1810, Genymobile#1827)
 - Add --forward-all-clicks option (Genymobile#1302, Genymobile#1613)
 - Add --legacy-paste option (Genymobile#1750, Genymobile#1771)
 - Workaround screen off/on issue on exit (Genymobile#1670)
 - Rework console/noconsole versions on Windows (Genymobile#1875, Genymobile#1988)
 - Terminate server properly without killing it on close (Genymobile#1992)
 - List available shortcut keys on error (Genymobile#1681)
 - Upgrade platform-tools to 30.0.5 (adb) in Windows releases
 - Upgrade SDL to 2.0.14 in Windows releases
@Phlip
Copy link

Phlip commented Nov 18, 2021

on KUbuntu, with --legacy-paste turned on, I can't paste wacky Unicodes like 𓃻. I can paste ASCII.

This is not mission critical; I tried to stress-test my app. I will try copy-n-paste from inside the Android tablet next.

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

No branches or pull requests

3 participants