We have moved to a new Sailfish OS Forum. Please start new discussions there.

Trying to get physical keyboards to work with AlienDalvik and Flatpak

asked 2020-04-18 03:47:38 +0300

ds1979 gravatar image

updated 2020-04-19 00:57:37 +0300

Hi sailors!

My bluetooth keyboard works perfectly with SaiflishOS, but: I want to get my physical bluetooth keyboard to work with AlienDalvik apps and Flatpak apps with the german layout (and any other layout!) . Perhaps some of you know, that the physical keyboard is stuck with US keymap for Android apps and Flatpak.

I am stuck with searching for the alien_wayland_keyboard and where its configuration files are. I believe that this is the crossing, where things come together. Here are two screenshots on my way to try to find out, what is happening.

AD menu Languages & Input devices. You can see the topic Physische Tastatur, which is the hardware keyboard.

AD menu Languages & Input devices. You can see the topic "Physische Tastatur", which is the hardware keyboard.

AD menu Hardware keyboard. You see, that I have added IBM keyboards with an Android app and changed it to German (IBM), but my bluetooth keyboard still writes with US keymap

AD menu Hardware keyboard. You see, that I have added IBM keyboards with an Android app and changed it to German (IBM), but my bluetooth keyboard still writes with US keymap

The configuration files and stuff for AlienDalvik seem to be somewhere in /opt/alien/system.img. How can I extract the image? I have tried: simg2img, unyaffs and unpackbootimg. No success...

Next step forward: sudo unsquashfs system.img extracts the file. Searching for alien_wayland_keyboard within these files didn't bring up any. I can see, that there is a generic keymap within system.img in the file /system/usr/keylayout/Generic.kl and qwerty.kl. There are no keymaps in /usr/share/X11/xkb. This leads to my assumption, that AlienDalvik goes back to the generic keyboard for compatibility reasons.

So, what's the next step?

Where is this alien_wayland_keyboard? Is it some SFOS piece, that I can't find, not something from AlienDalvik?

In the meantime, I have realized, that the same behavior is happening with flatpak within the Angelfish browser. So this might be something outside of AlienDalvik, right? Somewhere, there might be an interface to pass the information from the SFOS physical keyboard to other systems like AlienDalvik or Flatpak.

Edit: 2020-04-18


HID 1.0 (Human Interface Device Profile): Allows use of HIDs with Jolla, for example keyboards and mice. SailfishOS supports the American keypad layout only.

Today, the USB Foundation standard is: HID 1.12. So, there is a lot of work to get done, my friends!

bluez is open source, so we could do some really serious work. :-) I am just a user, who digs a bit underneath. I would need some serious people to help.

I am open for hints, where to follow the lead.

edit retag flag offensive close delete



This works for me within SFOS perfectly. I am switching to serbian this way, because there is no hardware keyboard mapping available in the settings menu. Still, it doesn't work for AlienDalvik.

ds1979 ( 2020-04-18 14:18:06 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-05-22 14:50:47 +0300

Kabouik gravatar image

updated 2020-05-23 23:26:24 +0300

Any change I make in /usr/share/X11/xkb/symbols/ reflects on the input in native applications (except compose with deadkeys does not work), but not in Alien Dalvik. One should be able to change the layout in Android Settings > Languages & input > Physical keyboard > Remote Keyboard as you showed, but like you said, only US seems to work, and somehow modifier keys (even Shift) don't work at all.

A workaround is to use the Android application External Keyboard Helper Pro:

  1. In EKH settings, go to Choose keyboard layout and choose the layout closest to what you want. I believe all layouts there are supplied by EKH itself, and not related in any way to the layouts and variants in /usr/share/X11/xkb/symbols/, meaning if you had a custom layout for SFOS, you cannot re-use it in EKH.
  2. However, if you go to Advanced settings > Keyboard mapping > Customize keyboard mappings, you can edit to your liking the base layout you selected previously.
  3. When you're all set, you can test your layout in the "Test area" (the tree-dot menu on the top tight). When focusing a text entry field for the first time, make sure you tap on the keyboard icon in the Android toolbar (where the back button is located) to select EKH Pro as text input instead of Remote Keyboard.

Your custon keyboard will be stored in /home/.android/data/data/com.apedroid.hwkeyboardhelper/files/custom.txt, in case you want a backup or want to share it. EKH Pro supports compose and dead keys, and you can even select multiple layouts and toggle between them using a keybinding (which you can do in SFOS too but only after enabling this option from command line with dconf). Unfortunately, it's a paid application, but it allowed me to use US-international and dead keys in Alien Dalvik with a hardware keyboard. There is a demo version you could test for free to make sure it works for you before deciding if the Pro version is worth a purchase. The demo really is just a demo, no way to use that permanently: "Everything works just like in the Pro version except for the Space button which prints a message that this is a demo version."

Not an ideal answer, I'd prefer to have all this functionality when using the default Remote Keyboard input in Android settings, but works as a temporary solution until using extra layouts is fixed in Remote Keyboard. I see you have been asking about using other layouts for Flatpak applications too in @rinigus' Github, obviously EKH won't be of any help there, sorry. :\

Also, putting this link here because I always struggle horribly to find it in TJC: https://together.jolla.com/question/46107/is-there-a-config-file-to-change-bt-keyboard-layout/?answer=67466#post-id-67466 Have you tried that?

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools



Asked: 2020-04-18 03:47:38 +0300

Seen: 500 times

Last updated: May 23 '20