zako (alongside libzako) is a minimal and performant Cangjie input method (library) implementation, targeting Wayland compositors that support the input method v2 and virtual keyboard v1 protocol.
The core library, libzako, has no dependencies besides the C standard library. The reference client implementation, zako (also functioning as a Wayland frontend), requires xkbcommon.
# generate C headers and glue code
wayland-scanner client-header wayland/input-method-unstable-v2.xml input-method-unstable-v2.h
wayland-scanner private-code wayland/input-method-unstable-v2.xml input-method-unstable-v2.c
wayland-scanner client-header wayland/virtual-keyboard-unstable-v1.xml virtual-keyboard-unstable-v1.h
wayland-scanner private-code wayland/virtual-keyboard-unstable-v1.xml virtual-keyboard-unstable-v1.c
# compile executable with optimizations
clang *.c libzako/*.c -o zako -lwayland-client -lxkbcommon -O3 -fltoCurrently zako does not support many configuration options. A Cangjie dictionary, like this one, is required. Consult zako -h for more information on supported options.
It operates in two states, active and inactive (default). When zako is active, it translates a set of keystrokes for input method purposes. C-\ toggles between states, left and right traverse between candidates, and enter commits the current pre-edit string.
Client-side key repeat is not implemented. Instead, zako relies on the repeated pseudo-state introduced in the seat v10 protocol, which is not yet widely supported by Wayland compositors.
This repository also hosts libzako, the library providing core input method functionalities. An optimized double-array trie (named the double decker) allows for O(1) input processing and prefix matching. For practical integration details, refer to zako, the reference implementation.