HType – open-source on-screen keyboard (IME) for HarmonyOS, written in ArkTS (hobby project, MIT)
I built an input method for HarmonyOS for my own use (ArkTS, strict mode, State Management V2) and am sharing the source as is under the MIT license. It is a private hobby project, and much of the code was written with an AI assistant (Claude). I built it with speed and privacy in mind: everything runs on the device, there is no network access, and in my PC simulation the autocorrect needs about 0.5 to 1 ms per word (not measured on a device). It feels fast on my devices, but I have not compared it with other keyboards.
What it does:
- Layouts: German QWERTZ, English, Arabic (also transliterated); separate tablet layout, tested on a MatePad Pro 12.2 in portrait and landscape
- Autocorrect and next-word prediction from a dictionary with word-pair and three-word context; two languages at once
- Touch model that adapts to your fingers; swipe typing
- Cursor control via the space bar, text selection, clipboard history, emoji layer with search
- Light/dark mode, glass strength, accent colour, haptics, one-handed mode on the phone
- Settings app with a personal dictionary and backup/restore
Privacy:
Only VIBRATE and READ_PASTEBOARD are declared. There is no internet permission, so the keyboard cannot send anything anywhere. READ_PASTEBOARD is a restricted permission; your device may not grant it.
How to run it:
- Install DevEco Studio with the HarmonyOS SDK for API 23 (6.1.0) or newer and open the project.
- Sign it yourself: File > Project Structure > Signing Configs > "Automatically generate signature". The debug signature is bound to your device. According to Huawei's FAQ, debug certificates last 14 days without identity verification and one year with it, so verifying your Huawei developer account is worth it.
- Build the dictionaries (see below), then run the entry module on your device and enable HType in the system keyboard settings.
Dictionaries:
The dictionaries are not included because the source data has mixed licenses (German-HDT: scientific use only, Arabic-PADT: non-commercial). A script builds them from public data in about 10 minutes. You need Git, Node.js 18+, about 1 GB of disk space and 3 GB of free RAM. It is a bash script; on Windows use Git Bash or WSL (not tested on Windows). Run this next to the project folder:
```
mkdir ../hype-data && cd ../hype-data
git clone --depth 1 --filter=blob:none --sparse https://github.com/hermitdave/FrequencyWords frequencywords
git -C frequencywords sparse-checkout set content/2018/de content/2018/en content/2018/ar
git clone --depth 1 --filter=blob:none --sparse https://github.com/common-voice/common-voice cv
git -C cv sparse-checkout set server/data/de server/data/en server/data/ar
git clone --depth 1 https://github.com/UniversalDependencies/UD_German-GSD
git clone --depth 1 https://github.com/UniversalDependencies/UD_German-HDT
git clone --depth 1 https://github.com/UniversalDependencies/UD_English-EWT
git clone --depth 1 https://github.com/UniversalDependencies/UD_Arabic-PADT
cd ../<project-folder>
bash tools/paket/bauen_alle.sh ../hype-data
```
This writes dict_de.tdb, dict_en.tdb and dict_ar.tdb into entry/src/main/resources/rawfile/. Build the app afterwards. Without the dictionaries the keyboard still types, but there is no prediction, autocorrect or swipe typing. Dictionaries you build are for your own private, non-commercial use. Licenses of the sources are listed in BUILD.md.
Tip: if you use an AI coding assistant with shell access (for example Claude Code), you can open the project folder and ask it to follow the dictionary steps in BUILD.md. It needs to run git and Node on your machine. I tested the steps myself, but an assistant may still need your help if something on your system differs.
Source code (MIT): https://github.com/HTypeOpensource/HType