119 lines
2.7 KiB
Markdown
119 lines
2.7 KiB
Markdown
# strans
|
|
|
|
A small input method daemon for Japanese, Korean, Vietnamese, emoji, and
|
|
symbols on X11 and Wayland. Inspired by 9front's ktrans.
|
|
|
|
## Build
|
|
|
|
The recommended build needs only Docker and Make on the host:
|
|
|
|
```sh
|
|
make docker
|
|
```
|
|
|
|
This creates an Arch Linux build image, compiles all runtime components in one
|
|
disposable container, and writes three artifacts into the source tree:
|
|
|
|
```text
|
|
strans daemon, IBus and Wayland frontend
|
|
xim/strans-xim XIM frontend
|
|
gtk/im-strans.so GTK 3 frontend
|
|
```
|
|
|
|
The build starts clean so host and container object files are never mixed. It
|
|
removes existing build and test outputs; the `strans-build` dependency image is
|
|
kept as a cache. No development packages are required on the host.
|
|
|
|
Void Linux runtime dependencies:
|
|
|
|
```sh
|
|
sudo xbps-install -S dbus-libs wayland libxkbcommon libxcb xcb-imdkit gtk+3
|
|
```
|
|
|
|
For a native Arch Linux build, use `Dockerfile` as the dependency and Plan 9
|
|
setup checklist, then run `make`. Build the benchmark separately with
|
|
`make bench`.
|
|
|
|
## Run
|
|
|
|
Start the daemon:
|
|
|
|
```sh
|
|
./strans map font &
|
|
```
|
|
|
|
For XIM applications:
|
|
|
|
```sh
|
|
./xim/strans-xim &
|
|
export XMODIFIERS=@im=strans
|
|
xterm
|
|
```
|
|
|
|
For GTK 3 applications:
|
|
|
|
```sh
|
|
sudo make -C gtk install
|
|
GTK_IM_MODULE=strans gedit
|
|
```
|
|
|
|
For IBus clients such as kitty:
|
|
|
|
```sh
|
|
GLFW_IM_MODULE=ibus kitty
|
|
```
|
|
|
|
Wayland needs no environment variable. Start `strans` after a wlroots
|
|
compositor that supports input-method-v2. Neither ibus-daemon nor fcitx is
|
|
required.
|
|
|
|
## Keys
|
|
|
|
Input modes are selected with Ctrl and one letter:
|
|
|
|
```text
|
|
Ctrl+N Hiragana
|
|
Ctrl+K Katakana
|
|
Ctrl+S Hangul
|
|
Ctrl+T English
|
|
Ctrl+V Vietnamese Telex
|
|
Ctrl+E Emoji and symbol search
|
|
Ctrl+P Toggle popup preedit
|
|
```
|
|
|
|
Use `1`-`9` or the arrow keys to select a candidate. Tab moves through
|
|
candidates, Enter commits, and Escape cancels.
|
|
|
|
Emoji search is temporary and returns to the previous input mode:
|
|
|
|
```text
|
|
Ctrl+E → smile → Enter → 😀
|
|
```
|
|
|
|
## Tests
|
|
|
|
Tests use the sibling `cutest` repository as a submodule. Its relative URL
|
|
expects repository mirrors and forks to provide the same sibling. Initialize
|
|
it once, then run the checks in the build container:
|
|
|
|
```sh
|
|
git submodule update --init
|
|
make docker-check
|
|
```
|
|
|
|
The native `make check` command needs plan9port and Python 3, but not the GUI
|
|
development packages. Use `make test TESTARGS=hangul` or
|
|
`make docker-check TESTARGS=hangul` to filter unit tests. After editing
|
|
`map/emoji.src`, regenerate and verify the dictionary with:
|
|
|
|
```sh
|
|
map/mkemoji > map/emoji.dict
|
|
make verify-map
|
|
```
|
|
|
|
## Design
|
|
|
|
`strans` owns the input engine and candidate window. The XIM and GTK frontends
|
|
forward keys to it over a Unix socket; the IBus and Wayland frontends are built
|
|
into the daemon. Internal threads communicate through CSP channels.
|