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

Other keyboard layouts? #1

Open
werdnus opened this issue Jul 23, 2019 · 18 comments
Open

Other keyboard layouts? #1

werdnus opened this issue Jul 23, 2019 · 18 comments

Comments

@werdnus
Copy link

werdnus commented Jul 23, 2019

Hey, first off, thanks for making keyWriter! This was the thing that finally made me decide to poke into the back-end of my reMarkable and get it to do more than the manufacturer intended — I've been wanting a way to write without staring at a screen for years now!

My issue is maybe a little more like a feature request, I guess: I type on a non-QWERTY keyboard layout (Dvorak), and was wondering how I might modify keyWriter for use with a different keyboard layout?

Any advise helps! Thanks again for all the awesome work.

Complicating factor: I used the pre-built binaries for my installation, because I'm on a Mac, which apparently makes it impossible to built from source, because there is no toolchain available. If it's necessary, though, I can probably find a Linux box somewhere to use, I guess.

@johnverbiest
Copy link

I use the nl-be type keyboard and being able to change the keyboard layout would be awesome.

@andersvold
Copy link

I use Norwegian keyboard layout with æøå ÆØÅ keys

@strider72
Copy link

@werdnus As Mac OS-X is built on GNU, you might be able to set up that Linux stuff on your Mac. (?)

@klettervirus
Copy link

Has anyone found a solution to this issue? I would love to use a german (qwertz) keyboard layout. No idea if this is possible?

@benjaminsoellner
Copy link

benjaminsoellner commented May 26, 2021

I have also tried various means. (EDIT: I should add, that the fingerterm terminal app is equally stubborn concerning the default US keyboard. There I tried... ) localectl, (busybox )loadkmap and (busybox )loadkeys - all don't work, neither does modifying /etc/vconsole.conf directly. I am speculating one could attempt to modify the default OS keyboard locale in the /etc/u-boot* somehow but don't dare to do it being afraid to brick the device - don't have the time (and stress resilience) at my hands to potentially recover it if it doens't boot up anymore.

@benjaminsoellner
Copy link

benjaminsoellner commented May 30, 2021

Hi all! I found a solution how to enable a custom USB keyboard layouts for keywriter / remarkable - with the help of the awesome remarkable community - mainly the developers @Eeems and Alex0809. Disclaimer: it's a bit involved and you should know how to do things like building Qt apps from source etc.

Turns out that the Qt applications in the reMarkable don't use the keyboard layout set on the command line (via loadkeys / localectl) neither do they use an X-Server (so setxkbmap doesn't work either). Like other embedded systems, they access the keyboard directly as described here.

So if you read this document, you'll find that you need two things:

1. A qmap file for your keyboard layout

  • You can generate a qmap file from a kmap file. On any Linux system in order to get a kmap file you can do (replace de with the keyboard layout you'd like to use):
ckbcomp -layout de > my-layout.kmap
  • Then, get the tool kmap2qmap from Qt, I did that by building Qt (more specifically, qttools/src/kmap2qmap) from sources - building Qt from source is a bit involved, but you can start here: https://doc.qt.io/qt-5/build-sources.html

  • Once you have the kmap2qmap binary, create a qmap file (you can ignore the warnings about undefined symbols), and copy it over to your remarkable:

./kmap2qmap my-layout.kmap my-layout.qmap
scp my-layout.qmap root@remarkable:/home/root/my-layout.qmap

2. A shell script that sets the .qmap file as keyboard mapping before running keywriter

  • Create a custom bash script (e.g. /home/root/keywriter-keys.sh) that sets the environment variables to achieve the keyboard mapping before launching the actual application - write into it:
#!/bin/bash
export QT_QPA_EVDEV_KEYBOARD_PARAMETERS="/dev/input/event3:grab=1:keymap=/home/root/my-layout.qmap" 
/opt/bin/keywriter # or wherever you installed keywriter

Caveat: the grab=1 leads to the keyboard being dedicatedly reserved for the launched application until the application itself is terminated. This means, that you will manually need to kill the application before switching to another application that uses the keyboard (e.g. if you use the keyboard in two separate applications, like fingerterm and keywriter). Luckily, all launchers seem to support this quite easily.

  • Make it executable
chmod +x /home/root/keywriter-keys.sh
  • You can then define that executable as a launchable app in draft (e.g. /opt/etc/draft/keywriter-keys.draft):
name=keywriter-keys
desc=Simple Markdown editor (with custom keyboard layout) 
call=/home/root/keywriter-keys.sh
term=:
imgFile=keyboard

Below, you see remux with those additional *.draft entries on my rm2 - I now tap those whenever I have my keyboard connected and get the app with the keyboard layout properly set up. :) When I switch to another app, I kill the earlier one by tapping the displayed memory metric next to it - as it's done in remux - and that way "release" the grabbed keyboard.

EDIT: Of course it would still be nice to have a built-in switch of keyboard layouts at runtime. :) But I hope this at least for the time being provides some workaround.

image

@Sjatplat
Copy link

Ive tried everything now to build the kmap2qmap command on a linux mint. But im lost. Do you have a link that describes the process? Im not a power user on linux.

@myneur
Copy link

myneur commented Mar 10, 2023

@benjaminsoellner Great investigation!
Will this work even in the native xochitl UI if restarted?
Thanks for this guide!

@malgakhalil
Copy link

HI is this guide work the same as rm1 + i need your help is there a way to cantact you @benjaminsoellner

@Eeems
Copy link
Contributor

Eeems commented Jul 9, 2023

I recently went through the journey of building kmap2qmap. If you trust me, and the code running on my computer, here you go: kmap2qmap.zip

If you don't, or you would like to know how to build it yourself. Here are the steps I took:

git clone https://github.com/qt/qt5.git
cd qt5
./init-repository
# Insert "#include <limits>" into qtbase/src/corelib/global/qfloat16.h
# Insert "#include <limits>" into qtbase/src/corelib/text/qbytearray.h
./configure -prefix $PWD/qtbase
make -j$(nproc) module-qttools
cd qttools/src/kmap2qmap
qmake
make
cd ../../bin

The qt5 folder is 15G in size after doing this, and it took quite a while to download, configure, and compile. I have 32G of ram and a 5950X in my system as well.

@myneur
Copy link

myneur commented Jul 14, 2023

I recently went through the journey of building kmap2qmap. If you trust me, and the code running on my computer, here you go: kmap2qmap.zip

If you don't, or you would like to know how to build it yourself. Here are the steps I took: …

Thanks for providing the steps. How did you run the keyboard layout you created on the rM?
Is it necessary to recompile the whole rM linux as mentioned in ColemakMods/mod-dh#68 (comment) ?
Or is it enough to change QT_QPA_EVDEV_KEYBOARD_PARAMETERS and run a service as described as a bonus part of https://benkku.medium.com/the-remarkable-2-tablet-as-a-coding-writing-device-3981570343e2

Would you please provide the steps to make the updated keyboard layout work as well? Or even the qmaps you created (or languages like de and cz for me:) to test?

Thank you!

@Eeems
Copy link
Contributor

Eeems commented Jul 14, 2023

Thanks for providing the steps. How did you run the keyboard layout you created on the rM?

I didn't, but others were just following these steps: #1 (comment)

Is it necessary to recompile the whole rM linux as mentioned in ColemakMods/mod-dh#68 (comment) ? Or is it enough to change QT_QPA_EVDEV_KEYBOARD_PARAMETERS and run a service as described as a bonus part of https://benkku.medium.com/the-remarkable-2-tablet-as-a-coding-writing-device-3981570343e2

That is for the reMarakable 2 folio. It also is just recompiling a kernel module, not the entire kernel. That is required if you want to have a different keyboard layout in xochitl. The qmap is only good for remarkable-keywriter.

Would you please provide the steps to make the updated keyboard layout work as well? Or even the qmaps you created (or languages like de and cz for me:) to test?

#1 (comment)

@myneur
Copy link

myneur commented Jul 15, 2023

That is for the reMarakable 2 folio. It also is just recompiling a kernel module, not the entire kernel. That is required if you want to have a different keyboard layout in xochitl. The qmap is only good for remarkable-keywriter.

Just to make sure I understand you correctly. Are you saying that for changing the keyboard layout in xochitl native environment of the rM 2 type folio I need to recompile a kernel module and just the 6. Bonus step is not enough?
Did I get it right?
(If so I misunderstood it that the compilation is needed just to run other apps, and for the layout only the setup is needed…)
Thanks

@Eeems
Copy link
Contributor

Eeems commented Jul 15, 2023

That is for the reMarakable 2 folio. It also is just recompiling a kernel module, not the entire kernel. That is required if you want to have a different keyboard layout in xochitl. The qmap is only good for remarkable-keywriter.

Just to make sure I understand you correctly. Are you saying that for changing the keyboard layout in xochitl native environment of the rM 2 type folio I need to recompile a kernel module and just the 6. Bonus step is not enough?
Did I get it right?
(If so I misunderstood it that the compilation is needed just to run other apps, and for the layout only the setup is needed…)
Thanks

Correct. They use their own keyboard layout stuff instead of the standard qmaps. https://github.com/reMarkable/epaper-qpa/blob/master/epaperevdevkeyboardhandler.cpp

@benjaminsoellner
Copy link

benjaminsoellner commented Jul 15, 2023

Sorry, it has been a long time that I looked into this.

@myneur , if I remember correctly, it will work in the native launcher, but you do need to re-apply the changes on restart for the steps I did (or put them in some script that you can easily call after restart).

@Sjatplat , sorry, I don't have the environment set up in this way anymore and cannot provide more details at this point than the things I documented.

@myneur
Copy link

myneur commented Jul 15, 2023

@myneur , if I remember correctly, it will work in the native launcher, but you do need to re-apply the changes on restart for the steps I did (or put them in some script that you can easily call after restart).

Yeah, but also to recompile the kernel module, as @Eeems stated, so unfortunately much harder than I thought (out of my skills).

But thanks for your reply, appreciated.

@Eeems
Copy link
Contributor

Eeems commented Jul 15, 2023

Sorry, it has been a long time that I looked into this.

@myneur , if I remember correctly, it will work in the native launcher, but you do need to re-apply the changes on restart for the steps I did (or put them in some script that you can easily call after restart).

That was likely because you were testing before the folio came out. With the folio, they've completely changed how keymaps are handled in xochitl.

Yeah, but also to recompile the kernel module, as @Eeems stated, so unfortunately much harder than I thought (out of my skills).

What about the steps in ColemakMods/mod-dh#68 (comment) are you stuck on?

@myneur
Copy link

myneur commented Jul 17, 2023

What about the steps in ColemakMods/mod-dh#68 (comment) are you stuck on?

I'm not a programmer, just a designer+PM who can speak linux scripts or python and couple other languages, but docker and kernels are beyond my knowledge. I even tried to compile kmap2qmap, because I use rM heavily and having my (cz) language on the rM would help me, but I got stuck in environment errors there as well and gave up. I love rM to invest hours into it, but I don't have days that I'd need because of my lack of expertise in this domain.

But thanks for your care!

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

No branches or pull requests

10 participants