feat(paste): auto-insert transcript at cursor via wtype/xdotool/ydotool/osascript/SendKeys

Adds an opt-in "auto-paste into focused window" toggle. When enabled, the
dictation pipeline sets the clipboard and then sends a Ctrl+V / Cmd+V
keystroke to whatever window currently has focus — the common case after a
global-hotkey dictation, since Kon's own window never stole focus.

Backend (src-tauri/src/commands/paste.rs) probes for a platform paste tool
and falls back cleanly:
- Linux Wayland: wtype > ydotool > xdotool
- Linux X11: xdotool > ydotool > wtype
- macOS: osascript System Events keystroke
- Windows: PowerShell WScript.Shell SendKeys

detect_paste_backends is a pure probe used by Settings to describe the
available backend next to the toggle (or nudge the user to install one).
paste_text always copies first, so auto-paste failure degrades to the
existing clipboard-only behaviour and surfaces a warn toast.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 07:45:16 +01:00
parent 36efcf2320
commit 4c0c876ade
7 changed files with 304 additions and 1 deletions

View File

@@ -307,6 +307,9 @@ pub fn run() {
commands::windows::open_viewer_window,
// Clipboard
commands::clipboard::copy_to_clipboard,
// Paste (auto-insert at cursor)
commands::paste::paste_text,
commands::paste::detect_paste_backends,
// Hardware
commands::hardware::probe_system,
commands::hardware::rank_models,