From 82fa754497683f5083cc4b7445e48309eebf20ed Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:47:10 +0200 Subject: [PATCH] ai: ctrl+v to attach file note: only convenient with dolphin --- .../quickshell/ii/modules/sidebarLeft/AiChat.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml index 814077787..29411b7ae 100644 --- a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml @@ -647,13 +647,24 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\) root.handleInput(inputText) event.accepted = true } - } else if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_V) { // Intercept Ctrl+V to handle image pasting + } else if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_V) { // Intercept Ctrl+V to handle image/file pasting + if (event.modifiers & Qt.ShiftModifier) { // Let Shift+Ctrl+V = plain paste + messageInputField.text += Quickshell.clipboardText + event.accepted = true; + return; + } // Try image paste first const currentClipboardEntry = Cliphist.entries[0] + const cleanCliphistEntry = StringUtils.cleanCliphistEntry(currentClipboardEntry) if (/^\d+\t\[\[.*binary data.*\d+x\d+.*\]\]$/.test(currentClipboardEntry)) { // First entry = currently copied entry = image? decodeImageAndAttachProc.handleEntry(currentClipboardEntry) event.accepted = true; return; + } else if (cleanCliphistEntry.startsWith("file://")) { // First entry = currently copied entry = image? + const fileName = decodeURIComponent(cleanCliphistEntry) + Ai.attachFile(fileName); + event.accepted = true; + return; } event.accepted = false; // No image, let text pasting proceed } else if (event.key === Qt.Key_Escape) { // Esc to detach file