CristianHenzel / ClipIt

ClipIt clipboard manager for GTK+
https://github.com/CristianHenzel/ClipIt
GNU General Public License v3.0
651 stars 83 forks source link

copy the entire clipboard #10

Open shrd opened 12 years ago

shrd commented 12 years ago

a good feature that miss is an option to copy the entire clipboard, all the lines, because the history file is not very usable without a program to parse it (may be you have a script to remove extra characters and parse the file) i see well a new ctrl alt + key that copy all the lines into a new line. it prevents the use of history file.

CristianHenzel commented 12 years ago

Hello,

could you please elaborate the idea? I'm not really sure what you mean, maybe you could also give an example of what exactly you want/need to do, so I can better understand your use-case.

shrd commented 12 years ago

hello , i'd like to have an option to copy all the history file. it can be useful if I select many text blocks to be copied into clipit and want to process the copies after. And the history file is not easy to use for that. So i see well an option that copy all the history file (and then all the lines) into an new line. we can after paste this line (new copy) and get all the history file (and then all previous copies). an hotkey for this will be even better.

ghost commented 12 years ago

This idea fits also my thinking. I would appreciate a lot this function which I call multiple tastes. It would be nice to be able to copy more than one input and finally, I prefer the output result to be in the following format:

paste 1 empty line paste 2 empty line etc.

It's really useful when I read books and try to grab the important lines! Is it possible to do?

johanfrick-zz commented 12 years ago

This is a feature I miss quite often as well.

davidsands commented 12 years ago

Having easy access to the history is very useful. Here is a utility I wrote in Python. This works on Ubuntu. On other systems the location of the history file might be different.

#!/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
johanfrick-zz commented 12 years ago

Cool, I got this working in command line. How can I use that to directly paste to a running program?

davidsands commented 12 years ago

If I understand you correctly, you could pipe the output of cliphist.py into the clipit command (to make it a single history entry), then paste that as usual in the other program.

$ cliphist.py | clipit
shrd commented 11 years ago

@davidsands nice script

i add it in my bashrc : alias clipit.history='python2 /home/emmanuelux/scripts/cliphist.py' alias clipit.history.copy='clipit.history | clipit'