From 16af2dbfffdb65a647b4b8909d904223669be6a4 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 27 Jun 2026 16:42:58 +0100 Subject: [PATCH 1/2] Use secret hint to prevent copy-then-type emoji from appearing in clipboard history Fixes #27 --- src/runner/emojirunner.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/runner/emojirunner.cpp b/src/runner/emojirunner.cpp index 3fe33c8..043deb5 100644 --- a/src/runner/emojirunner.cpp +++ b/src/runner/emojirunner.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -120,12 +121,30 @@ void EmojiRunner::match(KRunner::RunnerContext &context) void EmojiRunner::run(const KRunner::RunnerContext & /*context*/, const KRunner::QueryMatch &match) { - QApplication::clipboard()->setText(match.text()); if (match.selectedAction()) { + QMimeData *mimeData = new QMimeData(); + mimeData->setText(match.text()); + + // Add the sensitive hint to prevent emoji being shown in clipboard history + mimeData->setData("x-kde-passwordManagerHint", "secret"); + + QApplication::clipboard()->setMimeData(mimeData); + // Wait for krunner to be closed before typing QTimer::singleShot(pasteTimeout, this, [this]() { emitCTRLV(); + + // Clear the clipboard so the previous content returns + QTimer::singleShot(250, this, [this]() { + QApplication::clipboard()->clear(); + + // A second ctrl-v is needed to bring whatever was in the clipboard back in. + // For some reason. + emitCTRLV(); + }); }); + } else { + QApplication::clipboard()->setText(match.text()); } } From b2085e5a2d33d7226927f895d27d29e56a975c2c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 31 Jul 2026 16:44:27 +0100 Subject: [PATCH 2/2] Remove unnecessary extra paste --- src/runner/emojirunner.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/runner/emojirunner.cpp b/src/runner/emojirunner.cpp index 043deb5..e9747e9 100644 --- a/src/runner/emojirunner.cpp +++ b/src/runner/emojirunner.cpp @@ -135,12 +135,8 @@ void EmojiRunner::run(const KRunner::RunnerContext & /*context*/, const KRunner: emitCTRLV(); // Clear the clipboard so the previous content returns - QTimer::singleShot(250, this, [this]() { + QTimer::singleShot(pasteTimeout, this, [this]() { QApplication::clipboard()->clear(); - - // A second ctrl-v is needed to bring whatever was in the clipboard back in. - // For some reason. - emitCTRLV(); }); }); } else {