From bdbdf7cb8328804d52d5c62d34a307ae760f935b Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 22 Aug 2025 20:30:51 +0700 Subject: [PATCH] sidebar: ai: esc to detach file --- .../quickshell/ii/modules/sidebarLeft/AiChat.qml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml index a2f4a3a0..e3056b57 100644 --- a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml @@ -631,17 +631,22 @@ 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) { + } else if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_V) { // Intercept Ctrl+V to handle image pasting // Try image paste first const currentClipboardEntry = Cliphist.entries[0] if (/^\d+\t\[\[.*binary data.*\d+x\d+.*\]\]$/.test(currentClipboardEntry)) { // First entry = currently copied entry = image? - print("CLIPBOARD IZ IMAGE, ATTACHING I REPEAT ATTACHING") decodeImageAndAttachProc.handleEntry(currentClipboardEntry) event.accepted = true; return; } - event.accepted = false; - // fall through to normal paste for text + event.accepted = false; // No image, let text pasting proceed + } else if (event.key === Qt.Key_Escape) { // Esc to detach file + if (Ai.pendingFilePath.length > 0) { + Ai.attachFile(""); + event.accepted = true; + } else { + event.accepted = false; + } } } }