This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Clear the clipboard history?

Tags: clipboard, history, shell clipboard, history, shell clipboard, history, shell
(comma "," separated)
User avatar
Kresimir
Registered Member
Posts
18
Karma
0
OS

Clear the clipboard history?

Mon Jan 25, 2021 7:31 am
How can I clear the clipboard history from the command line on Plasma 5?

I'm copying some sensitive information from a file using `xclip -sel c` and I would like to clear the clipboard when my script exits, but I can't find how to do that anywhere in the documentation...


Currently running Plasma 5.26.3 on Arch Linux (as of November 2022, the signature could be outdated by now).
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS

Re: Clear the clipboard history?

Mon Jan 25, 2021 2:23 pm
Click on the Clipboard icon in the System Tray and use the "Clean history" button at the top right


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
User avatar
Kresimir
Registered Member
Posts
18
Karma
0
OS

Re: Clear the clipboard history?

Mon Jan 25, 2021 4:51 pm
Kresimir wrote:...from the command line...

Mamarok wrote:Click on the Clipboard icon...

It is regrettable you haven't even bothered to read my post. :(

It would have been better if you hadn't replied at all: now the post no longer appears in the unanswered posts, and the likelihood of someone replying with something useful is diminished.


Currently running Plasma 5.26.3 on Arch Linux (as of November 2022, the signature could be outdated by now).
User avatar
Section_8
Registered Member
Posts
61
Karma
0
OS
If you are using klipper, QDbusViewer shows that org.kde.klipper has a clearClipboardContents and clearClipboardHistory method that you should be able to invoke using dbus.

I haven't done enough dbus scripting to post the exact syntax here, I think there are examples online.
User avatar
Kresimir
Registered Member
Posts
18
Karma
0
OS

Re: Clear the clipboard history?

Mon Jan 25, 2021 6:40 pm
Thanks! :)

The exact command is:

Code: Select all
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory


Works like a charm!


Currently running Plasma 5.26.3 on Arch Linux (as of November 2022, the signature could be outdated by now).


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]