XKey for Mac

The latest version of XKey for Mac is 1.2.31, released . Vietnamese input method engine.

What's new in XKey 1.2.31

perf(telex): keep the literal guard off the keystroke hot path

The early literal guard added in 6e85962 ran the word string build, the

user/dictionary lookups and a file-attribute stat (isDictionaryLoaded ->

FileManager.attributesOfItem) on every keystroke before the structural

check — 18.01 us/keystroke vs the 6.6 us perf gate (baseline 2.19).

  • Run deadStateReason() first; only a structurally dead word pays for the

word string and dictionary lookups. Decisions are unchanged: guard still

fires on dead ∧ letters>=2 ∧ not a dictionary/user-dictionary word.

Show 2 more
  • Drop the isDictionaryLoaded stat: isValidWord already checks the user

dictionary and returns false when no dictionary is loaded.

  • Precompute valid prefixes of endConsonantTable and validSequences into

static sets instead of rebuilding arrays per table row per keystroke.

Measured after: ~2.3 us/keystroke (0.23 s per 100k keys), Release gate

green; Debug suite and XKeyIM build pass.

Ships as 1.2.31 (20261126.1): v1.2.30 already went out with the regression.

Source: github.com

How to update XKey on your Mac

XKey version history

  1. 20261126.1

    perf(telex): keep the literal guard off the keystroke hot path

    The early literal guard added in 6e85962 ran the word string build, the

    user/dictionary lookups and a file-attribute stat (isDictionaryLoaded ->

    FileManager.attributesOfItem) on every keystroke before the structural

    check — 18.01 us/keystroke vs the 6.6 us perf gate (baseline 2.19).

    • Run deadStateReason() first; only a structurally dead word pays for the

    word string and dictionary lookups. Decisions are unchanged: guard still

    fires on dead ∧ letters>=2 ∧ not a dictionary/user-dictionary word.

    • Drop the isDictionaryLoaded stat: isValidWord already checks the user

    dictionary and returns false when no dictionary is loaded.

    • Precompute valid prefixes of endConsonantTable and validSequences into

    static sets instead of rebuilding arrays per table row per keystroke.

    Measured after: ~2.3 us/keystroke (0.23 s per 100k keys), Release gate

    green; Debug suite and XKeyIM build pass.

    Ships as 1.2.31 (20261126.1): v1.2.30 already went out with the regression.

    Source: github.com

  2. 20260919.1

    fix(xkeyim): inject asynchronously so the IMKit thread stays free

    XKeyIM runs its event tap on the main run loop of the process that is also the

    active input method, and injectSync blocks that thread for the whole

    backspace -> text sequence. The focused app queries this same process through

    IMKit for every injected event before delivering it, so WebKit gave up on the

    unanswered reply and dropped the event: Vietnamese lost every diacritic in

    Safari web fields while physical keys still landed. TextEdit, which does not

    wait on the input method that way, was unaffected, and .slow always worked

    here only because it was the one method allowed to leave the tap callback.

    Give the injector a prefersAsyncDirectInjection flag, wired through

    TapEnvironment and set for XKeyIM alone, and let .fast and the empty-char

    prefix take the async direct-post path when it is set. XKey.app is not an input

    method, so nothing waits on its main thread and it keeps the proxy path

    unchanged. The post branches duplicated across four senders move into one

    postInjected helper, the injection debug lines name the route they took, and

    the unused sendUnicodeCharacter goes.

    Safari also reports the focused element of a page as AXWindow or AXGroup for a

    moment at a time — observed while typing in a GitHub comment box, where focus

    flapped AXTextArea -> AXGroup -> AXWindow without the caret leaving the field.

    Both the type-ahead inference and the address-bar cache read such a blink as

    "no editable field has focus, so the address bar does" and answered .fast +

    needsEmptyCharPrefix, sending a U+202F and one backspace too many into the

    page, overriding the user's Window Title Rules along the way. Record when a

    real page text field was the confirmed focus and give it a short grace window:

    while it holds, the type-ahead inference stays quiet and the cache is dropped

    rather than applied. An address bar that identifies itself still wins.

    Finally, wire debugLogCallback and verboseEngineLogging in TapController. A

    debug log captured while XKeyIM owned the keyboard held focus and

    injection-method lines and nothing else, which is why this bug could not be

    diagnosed from the log at all.

    Build scripts create the DMG with diskutil image create from where that

    subcommand exists, since macOS 27 deprecates hdiutil create, and fall back to

    hdiutil on systems without it.

    Injected events also need .slow spacing on that async route. Posted to the

    session tap about a millisecond apart, WebKit applies the second backspace after

    the text posted behind it — traced in a Safari textarea, where cos produced

    insert U+202F, delete, insert "ó", delete, so the diacritic was removed by the

    backspace meant for the character before it. The sleeps cost nothing here

    because they run off the tap callback.

    Source: github.com

  3. 1.2.31
  4. 1.2.29

    fix(telex): keep the word literal after undoing a non-adjacent circumflex

    Typing "queuee" undoes the free-mark ê ("quêu" -> "queue") and sets

    tempDisableKey, but the vRestore branch then calls insertKey, whose

    phonetic checkSpelling() ignores vowel clusters and re-enables marks.

    The next tone key landed on an invalid cluster: "queuees" -> "queúe",

    "keuees" -> "keúe". Adjacent undo ("teees") was only safe because of

    the three-identical-vowels rule.

    Keep tempDisableKey set after a circumflex undo (a/e/o) so the rest of

    the word stays literal. dd, mark and w undo are unchanged. Affects

    Telex and Simple Telex 1/2; VNI was never affected (its undo key is a

    digit).

    Bump version to 1.2.29 (20261117).

    Refs #339

    Source: github.com

Details

Latest version
1.2.31
Released
Last checked
Website
github.com
Homebrew cask
xkey