Skip to content

Command Mode: voice-triggered inline assistant (rewrite selection, clipboard context, Q&A) #139

Description

@DevEmperor

Idea adopted from WonderWhisper (dkapo88/WonderWhisper).

Summary

Add a spoken command mode: when a dictation starts with a trigger word (e.g. "command", configurable), the utterance is not inserted verbatim — instead it is treated as an instruction to an LLM that acts on the current context and inserts the result. This turns dictation into an inline voice assistant, reusing the rewording pipeline we already have.

Supported actions

  • Rewrite the selected text — "command make this more formal", "command translate to English". Uses the current text selection as the target (we already read selection for rewording prompts with requiresSelection).
  • Use the clipboard as context — "command reply to this", "command summarize this". The clipboard content is passed to the model as context. (This is the standalone clipboard-context idea; useful on its own.)
  • Answer a question — "command what's the capital of Japan" → inserts the answer directly in the field.
  • General transformations — free-form instruction applied to selection/clipboard/none.

Why

Today rewording is prompt-bar driven (tap a preset). A voice trigger removes the tap and makes ad-hoc, one-off instructions possible without predefining a prompt. Related but distinct from #14 (style prompt using context) and #10 (chat history for contextual input) — those are about passive context, this is an explicit spoken command.

Notes / implementation pointers

  • Detect the trigger word at the start of the transcript (locale-aware; make the word configurable, allow disabling).
  • Route the remainder through the existing rewording/chat path (OpenAiCompatibleClient.complete), building the user content from: instruction + optional selection + optional clipboard.
  • Decide selection- vs clipboard- vs no-context by simple heuristics (selection present → rewrite; else clipboard non-empty and instruction references "this" → clipboard; else plain Q&A).
  • Guard against empty/echo results like the existing auto-format guard (Auto-formatting spills the master prompt into the field on empty recognition #124).
  • Keep it opt-in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions