docs | ||
src | ||
.gitignore | ||
build.sh | ||
config.yaml | ||
generate-docs.sh | ||
README.md | ||
schema.sql | ||
sources.json | ||
universalime.nimble |
Introduction
Currently, in the Japanese space on Unix, you require third-party IME support to properly write kanji and kana. One of the more popular methods is toggling kanji conversion on and off from romaji, where you type "Konnnichiha" to produce "こんにちは".
These methods work efficiently, but they require specific integration for each window API. This limitation means that natively rendered programs or programs using APIs like SDL2 do not always work with IMEs. As a result, maintainers sometimes face challenges making them compatible. One workaround is interacting directly with X11 for kana and kanji support, which is what UniversalIME accomplishes.
UniversalIme
- Works Anywhere*
- GUI-Based Kanji Conversion
- Non-GUI Kanji Conversion (works anywhere*)
How does it work?
Inspired by , UniversalIME exploits the mutability of the keyboard map in X11. By utilizing unused keycodes (referred to as "Scratch codes"), UniversalIME allows you to type kana in romaji and convert it into kanji.
UniversalIme requires root
UniversalIME reads the Linux kernel's input channel for your keyboard and mouse (see jinput.nim) at /dev/input. When kana reading is enabled, it processes it through a romaji converter. Once the kana converter produces an output (e.g., 'w + a' -> わ / ワ), it removes the input characters by sending a backspace to the Xserver.
This means that, in most cases, you can write kana and kanji anywhere you can type.
How do I type kanji?
By default, the process is as follows:
-
Type the kana you want to convert, e.g., ろく (roku).
-
Determine the number of kana you wish to convert. For 'roku', it's 2. If you only want to convert 'ku', you would choose '1'.
-
Type the prefix keybind (by default, Ctrl+Shift) followed by the length of the kanji you want to search. For example, Ctrl+Shift+2.
-
If GUI is enabled, a graphical interface will appear at your mouse cursor. Otherwise, you can scroll through kanji options using macros. By default: Shift+Shift for up, Ctrl+Ctrl for down.
Too good to be true?
There are situations where programs might not support multi-byte characters or have code that prevents this method from working, such as 'Minecraft'. However, it works in other programs like Team Fortress 2, where many other IMEs fail. This could be considered a fundamental, potentially unfixable flaw.
Configuration
In /opt/universalime/config.yaml, you will find a configuration file where you can adjust various settings defined in config.nim. The default settings are defined in ./config.yaml and are statically linked into the compiled output.
Default Settings
- GUI (uses the GUI for kanji conversion instead of non-graphical interactive version)
- Start kanji conversion (left-shift + right-shift) (see readme)
- Enable katakana (Ctrl+Space)
- Convert to Kanji (Ctrl+Shift+Digit)
See config.yaml for the complete list of default settings. Modify them at /opt/universalime/config.ime.
Dependencies
- GTK3
Install GTK3 as it cannot be statically linked.