Skip to content

Accept input method text in the search field - #23

Open
indexss wants to merge 2 commits into
typecraft-dev:mainfrom
indexss:ime-support
Open

indexss wants to merge 2 commits into
typecraft-dev:mainfrom
indexss:ime-support

Conversation

@indexss

@indexss indexss commented Oct 22, 2026 •

Copy link
Copy Markdown

Problem

With fcitx5 (or ibus) running, Chinese/Japanese/Korean can't be typed into the launcher: pinyin keystrokes land in the query as plain Latin letters and no candidate window appears.

The search field is a Text, and keys are caught by a plain Item (keyCatcher) whose Keys.onPressed appends event.text to the query. Qt only enables the platform input context for a focused item that accepts input methods (TextInput/TextEdit), so the IME is never engaged — even with QT_IM_MODULE=fcitx set and the fcitx5 Qt6 plugin installed.

Change

keyCatcher becomes an invisible TextInput (in plugin/ui/LauncherWindow.qml):

  • Raw key events still go through handleKey first (Keys.priority: Keys.BeforeItem), so typing Latin text, navigation and every shortcut behave exactly as before.
  • Text committed by the IME lands in the TextInput and is immediately moved into the query (or the action panel filter when Ctrl+K is open), then the input is cleared.
  • The IME preedit (preeditText) is shown in the search field, and the caret follows it.
  • The TextInput sits on the caret, so the IME's candidate window opens right under the query.
  • Qt.inputMethod.reset() on hide, so an unfinished composition doesn't carry over to the next open.

The Keyboard line of the Status section in CLAUDE.md notes the input method support.

Testing

  • node --test tests/*.test.js: 88/88 pass.
  • Live on Omarchy (Hyprland, fcitx5 + Rime): oma-cast show, switch fcitx5 to pinyin, type nihao → preedit ni hao shows in the search field with the candidate window below it; space commits 你好 into the query and the Google/DuckDuckGo/agent fallbacks for 你好 appear.
  • With the IME off, typing goes through the unchanged handleKey path.

The query was built from raw key events on a plain Item, which Qt never
hands to an input method, so fcitx5/ibus users could not type Chinese,
Japanese or Korean. Use an invisible TextInput as the key catcher: keys
still go through handleKey first, IME commits are forwarded to the query
or the action panel filter, and the preedit is shown in the search field
next to the caret.
@indexss

indexss commented Oct 24, 2026

Copy link
Copy Markdown
Author

Rebased onto the latest main to resolve the conflicts with #28.

  • Committed IME text now goes through a new insertText helper that pasteClipboard also uses, so it lands in the action panel filter, the focused argument pill, or the query, the same as a paste. Typing CJK into the Search Google / DuckDuckGo argument pill works too.
  • The preedit only shows in the search field, not while an argument pill or the action panel has focus.
  • tests/launcher-paste.test.js wires up insertText in its harness; all 104 tests pass.

Tested on Omarchy 4.0.6 with fcitx5 + Rime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant