Speech & feedback
Speak a piece of text on its own (without captions), show a toast to the user, hide a window from screen recording / screen sharing.
Speak (standalone TTS)
python
host.speak(text: str, voice: str | None = None, language: str | None = None) -> bool
host.stop_speak() -> bool
host.is_speaking() -> bool- No captions — it only synthesises and plays; a failure returns
False(no exception). - When
voice/languageis omitted, the current TTS engine's default voice / target language is used. stop_speak()interrupts the current lightweight speak queue.- For "translation + caption + speak" as one unit, use
feed_direct_caption(..., tts=True)— do not combinespeak()+feed().
UI feedback
python
host.show_toast(message: str, level: str = "info", timeout_ms: int = 2500) -> bool
host.show_error(message: str, source: str = "plugin") -> boolshow_toast:level∈info|success|warning|error; goes through the host's unified toast channel. Good for light hints such as "switching device" or "voice registered".show_error: writes to the host'serrorOccurredchannel (the same UI as built-in errors); for genuine errors.- Both are signals into the UI and can be called from any thread.
- User-facing copy must speak plainly (do not expose internal exception stacks); stacks belong in
host.log("error", ...).
Anti screen-recording / anti screen-sharing
python
host.set_window_excluded_from_capture(window: Any, exclude: bool = True) -> bool- On Windows it uses
SetWindowDisplayAffinity(0x00000011): the window becomes completely invisible in screen sharing on Tencent Meeting / Zoom / Teams and the like. - Returns
Falseon non-Windows platforms. - Pass the QML-side window instance as
window:bridge.setWindowExcludedFromCapture(this, true).
Copilot window control
python
host.set_copilot_visible(visible: bool) -> bool
host.toggle_copilot_window() -> boolOnly meaningful when the plugin mounts the copilot_window slot or is itself an assistant type plugin; other plugins can ignore it.
Usage recommendations
| Need | Use |
|---|---|
| Speak the translation after a text selection | host.speak(translation) |
| Speak the translation + show captions at the same time | host.feed_direct_caption(text, tts=True) |
| Interrupt the current speak | host.stop_speak() |
| Light hint (1–3 seconds) | host.show_toast("…", level="info") |
| A genuine error | host.show_error("human-readable reason", source=self.id) |
| Anti-peeking for an interview assistant | bridge.setWindowExcludedFromCapture(this, true) |
