From 41cfff09f9b0cc0f73133f4e7be63ec94d65a6fd Mon Sep 17 00:00:00 2001 From: Linli Shi Date: Wed, 21 Oct 2026 22:14:57 -0400 Subject: [PATCH 1/2] Accept input method text in the search field 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. --- plugin/ui/LauncherWindow.qml | 32 +++++++++++++++++++++++++++----- tests/launcher-paste.test.js | 4 ++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/plugin/ui/LauncherWindow.qml b/plugin/ui/LauncherWindow.qml index 24a282e..fbff38a 100644 --- a/plugin/ui/LauncherWindow.qml +++ b/plugin/ui/LauncherWindow.qml @@ -115,6 +115,7 @@ PanelWindow { onShownChanged: { if (window.shown) return + Qt.inputMethod.reset() window.closePopups() var seconds = Number(window.general.popToRootTimeout) if (!(seconds > 0)) window.popToRoot() @@ -438,6 +439,12 @@ PanelWindow { clipboardInput.paste() var text = clipboardInput.text.replace(/[\r\n\u2028\u2029]+/g, " ") clipboardInput.clear() + window.insertText(text) + } + + // Pasted or input-method text: into the action panel filter, the focused + // argument pill, or the query. + function insertText(text) { if (!text) return if (window.actionPanelOpen) actionPanel.filter += text else if (window.argFocus >= 0) { @@ -640,12 +647,25 @@ PanelWindow { MouseArea { anchors.fill: parent; onClicked: { window.closePopups(); keyCatcher.forceActiveFocus() } } - Item { + // A TextInput, not a plain Item, so Qt enables the input method (fcitx5, ibus) for CJK typing. + TextInput { id: keyCatcher - anchors.fill: parent + x: caret.x + y: header.y + caret.y + width: 1 + height: caret.height focus: true + opacity: 0 + selectByMouse: false + font: queryText.font Keys.priority: Keys.BeforeItem Keys.onPressed: function(event) { if (window.handleKey(event)) event.accepted = true } + onTextChanged: { + if (!text) return + var committed = text + text = "" + window.insertText(committed) + } } Item { @@ -694,19 +714,21 @@ PanelWindow { x: lead.x + lead.width + window.px(12) width: Math.min(implicitWidth, header.queryRoom - (pills.visible ? pills.width + window.px(10) : 0)) anchors.verticalCenter: parent.verticalCenter - text: window.query || (pills.visible ? "" : window.placeholder) + readonly property string preedit: window.actionPanelOpen || window.argFocus >= 0 ? "" : keyCatcher.preeditText + text: (window.query + preedit) || (pills.visible ? "" : window.placeholder) color: window.look.foreground - opacity: window.query ? 1 : 0.45 + opacity: window.query || preedit ? 1 : 0.45 font.family: window.look.fontFamily font.pixelSize: Math.round(Style.font.heading * 1.15 * window.zoom) elide: Text.ElideLeft } Rectangle { + id: caret width: Math.max(1, Style.space(2)) height: queryText.font.pixelSize + Style.space(4) anchors.verticalCenter: parent.verticalCenter - x: queryText.x + (window.query ? Math.min(queryText.contentWidth, queryText.width) + Style.space(1) : 0) + x: queryText.x + (window.query || queryText.preedit ? Math.min(queryText.contentWidth, queryText.width) + Style.space(1) : 0) color: window.look.accent visible: window.shown && !window.actionPanelOpen && window.argFocus < 0 diff --git a/tests/launcher-paste.test.js b/tests/launcher-paste.test.js index bccb929..a9c4848 100644 --- a/tests/launcher-paste.test.js +++ b/tests/launcher-paste.test.js @@ -32,6 +32,10 @@ function harness(text) { context.next = next vm.runInContext(body("function setQuery(next)"), context) } + window.insertText = text => { + context.text = text + vm.runInContext(body("function insertText(text)"), context) + } window.pasteClipboard = () => vm.runInContext(body("function pasteClipboard()"), context) return { Qt, window, actionPanel, clipboardInput, changes, From 84e82bb0e30bc8b4f9ad2f8278a94af42b09a0e1 Mon Sep 17 00:00:00 2001 From: Linli Shi Date: Wed, 21 Oct 2026 22:20:09 -0400 Subject: [PATCH 2/2] Note input method support in CLAUDE.md status --- CLAUDE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CLAUDE.md b/CLAUDE.md index c2ea441..f232d9c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -120,6 +120,7 @@ Works: - **Ctrl+T** opens the toast's actions (Copy Error Message on failures, Undo after Disable Command). **Ctrl+Shift+K** opens the About panel for the selected row. - **Argument pills:** "Search Google" / "Search DuckDuckGo" take a query in a pill after the search text (Tab in, Shift+Tab out). - **Alerts:** Shut Down, Restart, Log Out and Delete All Entries ask first (↵ confirms, Esc cancels). `oma-cast run` skips the alert. + - **Input methods** (fcitx5, ibus) work in queries, argument pills, aliases and action filters: the key catcher is an invisible `TextInput`, so the IME is enabled, its preedit shows in the search field and committed text goes through `insertText` (shared with paste); raw keys still go through `handleKey` first. - **Feedback:** toasts in the footer, a HUD through Omarchy's OSD when the window closes, and a 2 px loading bar while guards and providers refresh (on every open, about 250 ms in the background). - **Window behaviour:** - The `escapeKeyBehavior` setting works both ways.