Bug 439143

Summary: Option to dump clipboard history to text file?
Product: [Plasma] plasmashell Reporter: Dashon <dashonwwIII>
Component: Clipboard widget & pop-upAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: wishlist CC: dashonwwIII, nate
Priority: NOR    
Version First Reported In: 5.22.2   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Dashon 2021-06-25 08:21:21 UTC
SUMMARY
Basically my use case is that I often end up copying and pasting a lot of things and it becomes a bit tedious to to go down to each entry in klipper and then copy that to the corresponding file and then repeat that for however many things I want to copy and paste. It would be nice to be able to dump the whole clipboards history to a file, so that I can either just use that file or copy and paste everything in the resulting file to the original. I don't know if that makes sense, so for example lets say this is my clipboard.

1.apple
2. orange
3. peach
4. pair

The way things are now I have to click on apple then paste to the file. Then click on orange and paste to the file. Then click on peach and paste to the file...etc, etc. Originally I had tried to write my own script, but it would seem that the history2.lst file that klipper saves its data too is a Qdatastream object or something. I can't really use any of the standard tools to convert it to plain text or to just grab the text. Currently it seems like I need to dig through Qt programming to extract this data.

STEPS TO REPRODUCE
1. Copy a bunch of individual things. I usually do this with names of various people, artist, and subreddits that I want to look up or write to a file to remember.
2. Start copying each entry one by one to a text file.


OBSERVED RESULT
Notice that is extremely tedious.

EXPECTED RESULT
Have a button to export to a file

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.12-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i7-7500U CPU @ 2.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620
Comment 1 Dashon 2021-06-25 21:42:23 UTC
I found a way to do it after really getting into it with the tr command and reading some forums. It isn't exactly pretty, but it works. There are some prepended special characters that I can't seem to perfectly remove just yet.

Here is the command that I'm using to dump the clipboard currently. It could definitely be refined a bit more:

tr -cd '\11\12\15\40-\176' < /home/d-air1/.local/share/klipper/history2.lst | cut -c 10- | sed 's/string/\n /g' | cut -c 2- | sed 's/[(*&$.,: "]//'
Comment 2 Nate Graham 2021-07-29 15:56:19 UTC

*** This bug has been marked as a duplicate of bug 307792 ***