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

Non english keyboard layout #37

Closed
elig0n opened this issue Mar 11, 2018 · 92 comments
Closed

Non english keyboard layout #37

elig0n opened this issue Mar 11, 2018 · 92 comments

Comments

@elig0n
Copy link

elig0n commented Mar 11, 2018

I have hebrew keyboard layout on both my computer and my android keyboard that is in use but it wouldn't let me pass the letters. Any chance to fix this?

@rom1v
Copy link
Collaborator

rom1v commented Mar 11, 2018

Any change to fix this?

Probably not. Only ASCII and some accented characters work.

Except if someone finds a technical solution ;)

@MiracleXYZ
Copy link

I used to have the same issue but it disappeared through some "practice":

  1. Turn to AOSP and type some numbers like 1234 (that works fine).
  2. Type some letters. If it doesn't work, press shift key several times. (You may say a bunch of letters "crowding in".
  3. Turn to GBoard or other keyboards. It will work fine if you are lucky :)

@wuairc
Copy link

wuairc commented Mar 12, 2018

One possible technical solution is to write a customized input method manager. Vysor(an scrcpy alternative) does this.
The input method manager can be installed and enabled by adb, without user interaction.

@AndroidDeveloperLB
Copy link

+1 on this. Wanted to write in Hebrew too, but failed.
Are you sure it's impossible to use adb to pass unicode keys ?

@vshymanskyy
Copy link

vshymanskyy commented Jun 22, 2018

@rom1v One of the possible options could be to create a custom keyboard, like NULL keyboard that I described here: #181, but with an ability to Input and Copy/Paste unicode. Probably not the easiest option, but at least something if there's no system API for such things.
AFAIK, KDEConnect installs own keyboard.

@AndroidDeveloperLB
Copy link

I would prefer without this workaround...

@giorgiobeggiora
Copy link

I strongly hope this will be fixed soon

@livin2
Copy link

livin2 commented Oct 26, 2019

https://remoboard.app/
example of this app may be help.
pass unicode via an wireless server independent from adb server.

@AndroidDeveloperLB
Copy link

@livin2 This means I have to change my default keyboard, which means I might have less features than what I want to have.
If an app is required, I would even install one that requires root, but having less features and having to switch keyboards as an alternative... This is just a hassle...

Is there maybe a way to do it using "monkeyrunner "? Someone wrote about this here:
https://stackoverflow.com/a/20615725/878126

@livin2
Copy link

livin2 commented Oct 26, 2019

If an app is required, I would even install one that requires root, but having less features and having to switch keyboards as an alternative... This is just a hassle...

feature like emoji mostly depend on the ime of computer.
and you can switch keyboards with adb shell in the script where you start scrcpy:

adb shell ime list -s 
adb shell ime set 【IME NAME】
adb connect 【xxx】
scrcpy -s 【xxx】

@AndroidDeveloperLB
Copy link

Yes, still a hassle. Once I disconnect from USB, I have to switch back to the keyboard I use.
Besides, all this time that I use Scrcpy I won't have any of the features of the keyboard that I use.

@pangliang
Copy link

Refer to the Vysor method, add a custom ime to enter unicode characters
#903

@electriquo
Copy link

i solved it by using an alternative keyboard for android. specifically, i am using anysoftkeyboard.

just be sure that your host operating system keyboard is set to the same language.

@mahengrui1
Copy link

recommend Gboard:
1 install Gboard 2 in it set non-English language with 26 key keyboard input method 3 input via scrcpy, the Gboard at Android will react as you are typing its 26 key keyboard 4 click the result via scrapy

@AndBroCorp
Copy link

Swedish letter å (u+00e5) still dont work.

[server] WARN: Could not inject char u+00e5
$ scrcpy -v
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.26.1 / 2.26.3
 - libavcodec: 59.37.100 / 59.37.100
 - libavformat: 59.27.100 / 59.27.100
 - libavutil: 57.28.100 / 57.28.100
 - libavdevice: 59.7.100 / 59.7.100
 - libusb: - / 1.0.26

@pedramardakani
Copy link

install scrcpy manually: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple

As you said, I've done that. image

But still can see the keyboard and can't usePersian keyboard. The command is following right? scrcpy --hid-keyboard

When I execute the program with the --hid-keyboard option, a notification icon comes up indicating a Physical Keyboard is attached. Touching it allows me to configure keyboard layouts for each keyboard available on the phone.

For example, after clicking on OpenBoard with Persion layout, I chose Farsi, Then, simply open up a note and change the PHONE keyboard layout. It should write in Farsi 😃

@david-shu
Copy link

android手机上安装qq输入法,可以在windows下正常输入中文。

Installing QQ input method on Android phones allows for normal Chinese input under Windows.

@sambul13
Copy link

sambul13 commented Feb 1, 2024

It does work with AnySoftKeyboard, once you install your chosen language pack for it on an Android phone. However, some of your language characters assigned to special character buttons of the physical PC keyboard may not print in the phone emulator window. So you might need to partially edit your Android language pack layout to work properly with scrcpy on a PC.

@rom1v
Copy link
Collaborator

rom1v commented Mar 2, 2024

Use scrcpy --keyboard=uhid since scrcpy v2.4 🚀

@AndroidDeveloperLB
Copy link

@rom1v Wait, this works on Windows OS too?
I will be able to write in Hebrew, for example?

@rom1v
Copy link
Collaborator

rom1v commented Mar 3, 2024

You tell me.

Reae the release notes: https://github.com/Genymobile/scrcpy/releases/tag/v2.4

@AndroidDeveloperLB
Copy link

@rom1v I tried to use it as this command :

C:\android\scrcpy\scrcpy-noconsole.vbs -S --always-on-top --stay-awake --no-audio -K

I switched to Hebrew on Windows, and started typing in some app on the Android device via ScrCpy, but it doesn't write it. It writes in English instead.

  1. Why the need of an extra parameter? In case it causes new bugs?
  2. Should I have done this differently?
  3. I tried with and without it. Also tried with "--keyboard=uhid" instead. I tried on 2 different PCs. Need some environment details?

@rom1v
Copy link
Collaborator

rom1v commented Mar 3, 2024

Did you configure the keyboard layout on the device as explained in the doc and in the release notes?

@AndroidDeveloperLB
Copy link

@rom1v It goes there to a weird screen that I don't understand what I should do in it:

image

I tried to reach "scrcpy" there and choose Hebrew, didn't help. I chose back English-US. Still didn't help.
How can I use it?

@rom1v
Copy link
Collaborator

rom1v commented Mar 3, 2024

I don't know how hebrew keyboards work, but basically, this feature should work as if you plugged/connected a physical keyboard to your device.

@AndroidDeveloperLB
Copy link

@rom1v Please explain what I should do. You can talk about any language you wish. I'm sure it should be the same.
What should I do on this screen?

@rom1v
Copy link
Collaborator

rom1v commented Mar 3, 2024

Please explain what I should do. You can talk about any language you wish.

I tried to reach "scrcpy" there and choose Hebrew

This is the expected thing to do.

#4473 (comment)

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Mar 3, 2024

@rom1v It seems it's not related to this screenshot, and not to the comment you've linked to.
What's missing and isn't written (please add this into the instructions), is to do this:

  1. In ScrCpy, press left-ALT+K . Found from here: [WIP] UHID mouse/keyboard input #4473 (comment) . Basically seems the same as the adb command.
  2. If the layouts you want are missing, reach the available layouts, and choose all languages you wish to handle. On one device they were missing so I had to choose them. On another they were already selected.
  3. In order to switch languages, don't use the one of Windows OS. Instead use CTRL+Space.

Can you please somehow avoid the CTRL+Space, and just use what the (Windows) OS has? Meaning to be in sync with the current language of the OS ? It's confusing...

@AlynxZhou
Copy link
Contributor

just use what the (Windows) OS has? Meaning to be in sync with the current language of the OS

They are different input methods of independent systems, so you should never expect they are in sync, and when you press Ctrl+Space, it is likely that Windows catch it before scrcpy get it.

I think scrcpy should behave like other SDL2 games which totally disable/ignore Windows (and other OS) input methods, because when we use HID keyboard, we are using Android's input method, so the Windows input method is useless.

@AndroidDeveloperLB
Copy link

@AlynxZhou I know they are different, but Locale is a standard thing, and if they match, why not try to be in sync?

Or at least have the combination the same as on Windows? Why is it CTRL+space?
Isn't it possible at least to capture the combination that's set on the OS and use it instead?

@AlynxZhou
Copy link
Contributor

AlynxZhou commented Mar 3, 2024

@AlynxZhou I know they are different, but Locale is a standard thing, and if they match, why not try to be in sync?

Why you are assuming people have the same languages for PC and Phone? They may in different sequence, or just totally different, it needs a lot of codes to get and compare current input method.

Or at least have the combination the same as on Windows? Why is it CTRL+space? Isn't it possible at least to capture the combination that's set on the OS and use it instead?

If you mean Super (the "Windows" key) + Space, it might be caught by Windows, so scrcpy can never get this keybinding. I previously says Ctrl+Space, but it is a mistake, I am saying Super+Space, I think this is what you want. And again, that may be caught by system before application, you may never get this keybinding in an app.

And if you still want this, please provide a API to get current keybindings for switch input method. It may still never works (because of the reason I say above), and different OS have different APIs, it is still not worthy to implement such a thing. Ignore system input method is still a better choice, because when you are using scrcpy, you really should never care about what input method is on PC.

Update: I think Android does not allow user to set a custom keybinding to switch input methods, you can only use pre-defined keybindings, like Ctrl+Space or Shift+Space, that's "Why is it CTRL+space", asking here for scrcpy devs cannot resolve the problem, it is not controlled by scrcpy.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Mar 3, 2024

@AlynxZhou Sure it can be different settings, but it's a good thing to have, no?

About the key combination, no, I didn't mean "super"/"windows" key. I mean "CTRL" key. It's at the bottom-left corner of the keyboard, or on the left of the arrows keys. Here, found an image on the Internet to show you what CTRL key is:
https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR6csyegg19d0L9dVmZqmUiQbTyn9VkWa-YmPOkjA2t-AWKBLr9tS62Kh8FVkg32N5J9Do&usqp=CAU
It's not what's set by the OS.
And I'm pretty sure it is possible to capture the change of the language, because if you use a remote-control app (AnyDesk, TeamViewer, NoMachine...), they capture it fine as it passes to the controlled PC.
Can't ScrCpy pass the request to change the locale of its keyboard?

There is also no indication of which language is currently being set, except when you let the virtual keyboard be shown too.

@AlynxZhou
Copy link
Contributor

@AlynxZhou Sure it can be different settings, but it's a good thing to have, no?

No, I'd like scrcpy never touches my system input method, it is not necessary for it to do so.

About the key combination, no, I didn't mean "super"/"windows" key. I mean "CTRL" key. It's at the bottom-left corner of the keyboard, or on the left of the arrows keys. Here, found an image on the Internet to show you what CTRL key is: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR6csyegg19d0L9dVmZqmUiQbTyn9VkWa-YmPOkjA2t-AWKBLr9tS62Kh8FVkg32N5J9Do&usqp=CAU It's not what's set by the OS. And I'm pretty sure it is possible to capture the change of the language, because if you use a remote-control app (AnyDesk, TeamViewer, NoMachine...), they capture it fine as it passes to the controlled PC. Can't ScrCpy pass the request to change the locale of its keyboard?

I know what is a "CTRL" key, if your question is why you cannot use Windows keybinding to switch input method, because which keybinding could be used to switch input method is controlled by Android here, Android does not support the keybinding you used in Windows.

The remote desktop application you mentioned can work because the target OS is still Windows so you can use Windows keybinding, but here we are targeting Android, not Windows.

scrcpy could fake key sequence, for example when get Super+Space, actually send Ctrl+Space via HID, which is what you want, but it makes what actually you get is not what actually you send, in other words, you are hiding things to user, and may leads into other conflicts.

There is also no indication of which language is currently being set, except when you let the virtual keyboard be shown too.

Gboard will show indicator in 1. Notification Icons (with physical keyboard) 2. Space Button (when showing virtual keyboard) 3. Floating Toolbar (if you are using a recent version of it). Ask your Android input method devs to add such an indicator is a better approach, instead of using Windows' indicator for it.

@AndroidDeveloperLB
Copy link

@AlynxZhou What do you mean by "touches my system input method" ? The window is focused, and you use the key combination to change the keyboard to type in a different language.
There is even the OS setting to remember the language per app.

I talked about remote control because you said you can't capture the keys.

I didn't mention "super" key. I wrote that ScrCpy uses CTRL+Space, and the one of Window is ALT+SHIFT. I think you can change it though, and for some countries Windows decides to set it differently by default.

What things are you hiding from the user? It changes just as CTRL+space would change.
Same behavior, just different trigger.

As for indicator, that's what I wrote. It won't show an indication unless you show the virtual keyboard. Going to other places to know the current one isn't an indicator that's shown right when you are about to type.
You wouldn't say "You can check if the smartphone has Wifi connection if you go to the Wifi screen and see it's connected", right? Such a thing appears as a real indicator in the notification/status bar. That's an indicator.

@AlynxZhou
Copy link
Contributor

the one of Window is ALT+SHIFT

Are you sure Android could switch input method with Alt+Shift?

@yume-chan
Copy link
Contributor

I don't know Hebrew, but if I select Hebrew in Keyboard Layout, now every key press results in these characters

image image

I don't know why it's so difficult for you

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Mar 3, 2024

@AlynxZhou I'm not the developer of ScrCpy and not the developer of Android framework. I'm a user of ScrCpy and I also develop apps for Android, but not of this sort.
I talked about how it works on Windows OS : ALT+SHIFT is used to switch languages, and you can choose in the settings of Windows OS that you wish each app would have it saved, so that you won't need to switch it all the time when switching between windows.

As for "difficult", switching languages isn't done with multiple steps. It's done in a single step. Key combination on Windows, and a single button (or gesture) on Android (in the virtual keyboard).

@AlynxZhou
Copy link
Contributor

I talked about how it works on Windows OS : ALT+SHIFT is used to switch languages, and you can choose in the settings of Windows OS that you wish each app would have it saved, so that you won't need to switch it all the time when switching between windows.

What if I have Japanese input method on Windows, but I don't have Japanese input method on Android?

@AndroidDeveloperLB
Copy link

@AlynxZhou Are you asking about the requesting of trying to be in sync?
Or about the trigger of the key combination?
If it's about the key combination, it's just triggering the switching of the language, so it goes to Android OS and there it will switch the same way it does now with ScrCpy with CTRL+Space.

If it's about the request of trying to be in sync, I don't know what's possible so I'm not the person to ask about what are the options of what would occur.
For example, if it's all Unicode characters anyway that you can pass forward, it doesn't matter what's set on the Android OS, because you will just forward whatever is used on the Windows OS. This way, you can also send special characters, such as "😊".
My guess that as the user has a keyboard app, the options are quite restricted and it might not even work on some of them, including probably what ScrCpy has now.

I wonder if Google will have better support for this topic now that Android Studio has its own mirroring solution. Maybe will benefit ScrCpy to support it too.
Any news for this on Android 15 , perhaps? Was it even requested, one way or another?

@AlynxZhou
Copy link
Contributor

Is there anyone who really understand what on the earth his request is? I'm getting more and more confusing while reading his reply...

My opinion is scrcpy should not care about Windows input method, because we are just simulating a HID keyboard, and the Windows input method really has nothing with us because we are using Android input method. So just ignore OS input method like most SDL2 games is fine.

Anyone who understand his request please help him, I decide to only leave my opinion here.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Mar 3, 2024

@AlynxZhou What is "SDL2 games"? ScrCpy is used for more than games...

The request is as I wrote, to try to be in the same way it works on other apps on Windows (and on Linux&MacOS):
To have the selected language of the OS affect the window. What you see in the OS indication is what you get when you type.
Or at least to have the key combination to be the same to switch languages. On the case of Windows, it's ALT+SHIFT for me. For other users it can be different.

I didn't mean to upset you. I try to explain for every question.

BTW, I tried now on a Samsung device (A32 with Android 13) , and the UI is different. Not sure how to set it up even though its keyboard is also Gboard :
image

I can't choose there multiple languages as on my Pixel 6 device with Android 14. Here I fail to switch to Hebrew, unless I go to this UI manually and choose Hebrew (but then can't write in English till I do the same here, and so on). In short, CTRL+Space doesn't work here unless there is something I've missed here.

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