Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to paste my whole clipboard history consisting of words copied (Ctrl+C/by selection) during my reading sessions. I installed programs like Glippy and ClipIt but I couldn't figure out how to paste all the words, if ever exists such an option in these programs, I copy to a simple text file at once, not one word at a time. Can someone help me out?

Thank you!

share|improve this question
    
clipit stores its history in ~/.local/share/clipit/history, the format has some control characters, you can probably parse them out with sed, but that's a bit complicated –  user35186 Sep 19 '12 at 15:06

5 Answers 5

there is python script for ClipIt run it like this python cliphist.py > clipit.history.txt

#!/usr/bin/env python
"""cliphist.py: utility to print clipit history file.
If an argument is passed on the command line, it will
be used as a separator, otherwise history items are
separated by a blank line. """

import struct, os, sys

homedir  = os.environ['HOME']
histfile = homedir + '/.local/share/clipit/history'
if len(sys.argv) > 1:
    sep = sys.argv[1]
else:
    sep = '---------------------------------------------------------------------'


with open(histfile,'rb') as f:
    f.read(68)
    size,_ = struct.unpack('2i',f.read(8))
    while (size > 0):
        item = f.read(size)
        print item
        _,_,_,size,_ = struct.unpack('5i',f.read(20))
        if size > 0: 
            print sep
share|improve this answer
    
haven't tried this, but it looks right and answers the question (regarding Clipit) –  user7610 Jul 12 at 15:16

Install KDE's Klipper Clipboard Manager Install klipper and use the following simple script:

text="nothing yet"
cnt=0
while [ "$text" != "" ]; do
  text=`qdbus org.kde.klipper /klipper getClipboardHistoryItem $cnt`
  echo "==== Clipboard content line $cnt:"
  echo "$text"                      # to terminal output
  echo "$text" > /path/to/file      # to file (EDIT this)
  cnt=$((cnt + 1))
done

Note: This does not behave very well in Unity so it seems. So in other desktop environments than KDE: your mileage may vary.

share|improve this answer
    
FWIW, someone having problems with Klipper and Unity: askubuntu.com/questions/439303/… –  Sparhawk Mar 26 at 10:05

The latest version of Parcellite has a Save As menu item when clicking the icon. This will save all the history entries to a file. There is also a paste all when right-clicking the history list, which will place the entire history list on the clipboard. The preferences have a Paste All delimiter that it will put at the end of each entry.

https://sourceforge.net/projects/parcellite/files/parcellite/parcellite-1.1.1/ ppa here: https://launchpad.net/~rickyrockrat/+archive/ppa

share|improve this answer

You can see some strings in clipit history file with this command:

strings ~/.local/share/clipit/history

But it's not the best way. The output may be garbled.

share|improve this answer

user Parcellite, left click on its icon, "clear", select how many times you want, after that, "edit clipboard" and copy it all! Remember so set preference: use primary selection, to make it easier to copy the text!

share|improve this answer
    
Hi Acquarius! Thank you so much for the reply. However, when I click edit clipboard I only see the last word I copied and not the whole list. Maybe with you it works another way? Maybe I must configure something in the preferences. –  pandisvezia Sep 21 '12 at 17:14
    
there is this file ~/.local/share/parcellite/history, the problem is it has non printable characters to newline and such.. you may try autoReplacing/erasing them but now this starts to get messy... –  Aquarius Power Jan 6 '13 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.