diff options
Diffstat (limited to 'desktop/assistant/Assistant.qml')
| -rw-r--r-- | desktop/assistant/Assistant.qml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml index c4d0771..33616ad 100644 --- a/desktop/assistant/Assistant.qml +++ b/desktop/assistant/Assistant.qml @@ -405,6 +405,7 @@ Scope { } if (!e.stopped) root.convId = e.id; root.lastActive = Date.now(); + if (!e.stopped && i >= 0) root.notifyDone(turns.get(i).reply); break; case "progress": if (root.opDaemon) root.opChars = e.chars; break; case "written": @@ -424,6 +425,7 @@ Scope { root.flush(); turns.setProperty(i, "error", e.message); turns.setProperty(i, "live", false); + root.notifyDone(e.message); } else { root.notice = e.message; } @@ -440,6 +442,27 @@ Scope { } } + // A reply that ends while the card is closed says so, and clicking the + // notification opens the card on it. notify-send -A waits until the + // notification is acted on or dismissed and prints the picked action. + // ponytail: one Process, so a newer reply's notification takes over + // (the stack tag replaces the balloon, and restarting drops the old wait). + function notifyDone(body) { + if (root.open) return; + notifyProc.command = ["notify-send", "--app-name=Assistant", "--icon=dialog-information", + "-h", "string:x-dunst-stack-tag:assistant", "-A", "default=Open", + "Assistant replied", body.slice(0, 200)]; + notifyProc.running = false; + notifyProc.running = true; + } + + Process { + id: notifyProc + stdout: StdioCollector { + onStreamFinished: if (text.trim() === "default") root.show() + } + } + Timer { interval: 50 repeat: true |
