[IPython-dev] automatic cpaste
Tue Jun 3 17:57:56 CDT 2008
2008/1/29 Ken Schutte <firstname.lastname@example.org>:
> I've been trying to figure out a way to make cpaste more "automatic".
> The closest I've come is the attached cpaste modification. Using "cpaste
> -a" automatically executes the contents of the clipboard; however, it
> requires the 'xclip' command, which is run with os.popen3(). (btw, xclip is
> a nice command-line utility - I've found it's in most distro's repositories,
> but usually not installed by default).
> I'm not sure if you'd want to add this patch because of this dependency, but
> it should be backward compatible as is. (or is there a better way to get the
> clipbard contents?)
> This is maybe a slight improvement for me, but I'd love something where I
> can truly do a simple paste with the mouse and everything is done
> automatically. I guess this is basically not possible within ipython?
> I usually use ipython within a Konsole window, so the only other thing I can
> think of is to figure out if you can easily do something there to make this
> happen, e.g. intercept a mouse paste, and instead paste in the text
> If anyone has any suggestions, please let me know.
Sorry for the long delay. As you can see, we're now trying to
re-energize work around here :)
The problem with your patch is that it adds an X11 dependency onto
ipython's core, and that's just not OK. We do have platform-specific
extensions and features, but not in the very core features, which
*must* remain portable.
However, if you can figure out a way to abstract out what's basically
a get_clipboard() functionality into something for which os-specific
backends can be written, this could certainly be done. There may even
be already in the freedesktop.org an API for clipboard access that
works on reasonably modern linuxes, and I'm sure both OSX and Win32
have APIs for the same thing.
In the meantime, you can keep this as a local magic function in your
own environment, so you can freely upgrade ipython versions without
losing your changes.
More information about the IPython-dev