(Probably) because I’ve set the Clipboard Manager’s maximum history entries to the plasmoid’s maximum
Consequently, I’d like to clear its history whilst retaining its history for myself. However, there doesn’t appear to be any obvious option in its GUI, like checkboxes allowing me to perform Ctrl+A to select all and copy them into one
No, it’s not the X/Y problem - I do want a record of everything that I’ve duplicated into the clipboard.
as a workaround, but it doesn’t print anything, weirdly. And I expect that it would solely provide the textual content of the clipboard anyway (text - How does X11 clipboard handle multiple data formats? - Stack Overflow).
qdbus command will display the entire clipboard history, so redirect to a file as required:
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.getClipboardHistoryMenu
Then you can clear it with the GUI.
Do you know whether there’s a way to poll the amount of entries currently in the clipboard history so that I can automatically export and clear it programmatically in the background, should it reach 2048 entries?
I ask because I haven’t been able to find a QDbus command to clear it. Apologies if I’m being stupid. How to run (Q)Dbus for Qt5/6 from CLI? - Applications - openSUSE Forums hasn’t been answered yet.
qdbus org.kde.klipper /klipper will get you a list of available commands. One of these commands should work, although I haven’t tested it:
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardContents
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory
I usually clear the clipboard with
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory && xclip -sel c -i < /dev/null
A basic draft of the answer is below in case it’s useful. Thanks for all of your help.
#!/usr/bin/env -S pwsh-preview
$ClipboardContent = qdbus6 org.kde.klipper /klipper org.kde.klipper.klipper.getClipboardHistoryMenu
Add-Content -Path '' -Value "$ClipboardContent"
qdbus6 org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardContents
qdbus6 org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory