Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 27 additions & 5 deletions plugin/ui/LauncherWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions tests/launcher-paste.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down