From 1b7b1a0051aac26497899690b82cbeb794aa9de9 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Thu, 26 Mar 2026 17:06:47 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20rdp=5Ftype=20now=20actually=20types=20?= =?UTF-8?q?=E2=80=94=20clipboard=20+=20Ctrl+V=20keystroke=20sim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was only setting the remote clipboard without pasting. Now sends clipboard content then simulates Ctrl+V (scancode 0x001D + 0x002F) with 50ms delay for clipboard propagation. Works for any text including special characters and multi-line content. Co-Authored-By: Claude Opus 4.6 (1M context) --- src-tauri/src/mcp/server.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/mcp/server.rs b/src-tauri/src/mcp/server.rs index 4ece5f7..8f30231 100644 --- a/src-tauri/src/mcp/server.rs +++ b/src-tauri/src/mcp/server.rs @@ -504,9 +504,19 @@ async fn handle_rdp_click(AxumState(state): AxumState>, Json } async fn handle_rdp_type(AxumState(state): AxumState>, Json(req): Json) -> Json> { - // Type text by sending it via clipboard paste (most reliable for arbitrary text) + // Set clipboard then simulate Ctrl+V to paste (most reliable for arbitrary text) if let Err(e) = state.rdp.send_clipboard(&req.session_id, &req.text) { return err_response(e); } - ok_response(format!("typed {} chars", req.text.len())) + // Small delay for clipboard to propagate, then Ctrl+V + tokio::time::sleep(std::time::Duration::from_millis(50)).await; + // Ctrl down + let _ = state.rdp.send_key(&req.session_id, 0x001D, true); + // V down + let _ = state.rdp.send_key(&req.session_id, 0x002F, true); + // V up + let _ = state.rdp.send_key(&req.session_id, 0x002F, false); + // Ctrl up + let _ = state.rdp.send_key(&req.session_id, 0x001D, false); + ok_response(format!("typed {} chars via clipboard paste", req.text.len())) } async fn handle_rdp_clipboard(AxumState(state): AxumState>, Json(req): Json) -> Json> {