[nSLUG] cat-like command

Ted Tibbetts intuited at gmail.com
Mon Dec 21 12:42:20 AST 2009


Some clipboard managers -- parcellite is the name of the one I use -- also
provide this facility, a bit more conveniently than xclip.  With xclip you
do something like
$ cat file | xclip -selection clipboard
If you leave out the option, it goes into the (primary) X *"selection*", not
the clipboard, meaning that to get it out you click the middle mouse button
somewhere.  this is particularly inconvenient when you want to replace some
text with other text, and would like to do that by selecting it and then
pressing CTRL-V.  The X "selection" is the last thing highlighted in any
app.
With parcellite you just pipe into parcellite, à la
$ cat file | parcellite
Parcellite assumes that you want that to be saved to the "clipboard", not
the "selection", so subsequently you can just do CTRL-[SHIFT-]V,
Edit->Paste, or parcellite -o to put it somewhere, eg "$ parcellite -o |
grep nice".  It also keeps a history stack that you can browse to find
previously-clipped (via Edit->Copy, CTRL-[SHIFT-]C, "+yiW, etc) or -piped-in
items.  There are lots of similar programs: klipper, glipper, etc;
parcellite is the streamlined fresh face on the scene.  These applets live
in the window dock and mainly serve to record history; I'm not sure if it's
similarly convenient to pipe output into the other managers.
It and the other clipboard managers all have other features too -- in
particular actions that you can trigger (or arrange to have triggered) on
clipboard contents.  The idea is that you can send URLs etc. to their
appropriate applications, but you can set it up to run filters on the
contents and then save the altered contents back to the clipboard, or call
shell scripts, or whatever.  I have an action set up that parses URL-encoded
URLs out of the arguments of a URL; this is useful, for example, when
somebody posts a video on Facebook and I don't want to have to follow the
link and copying the resulting URL before sending the youtube link off to
vlc or youtube-dl.
Perhaps surprisingly, one of the most useful possibilities with clipboard
manager actions is to pipe the contents directly back into the manager
without changing them at all, eg 'parcellite -o | parcellite'.  This has the
effect of making parcellite the provider of that data, which avoids the
problem of having the data disappear from the clipboard when you close the
app you copied from, or worse throwing X into seizures.  This last can
happen if you use CTRL-Z to suspend the last app you 'copied' from, and then
try to paste the clipboard contents somewhere, like for example in the
terminal window where you just suspended your text editor.  I gather that
this creates a race condition of some variety; at any rate X seems to find
it very interesting and proceeds to use a lot of processor time working on
it.
As a former Windows user I came to linux with a different mental model of
how a "clipboard" works -- I expected that "copying" to it would actually
create a copy, but it really just writes down the app's number on the
clipboard so that somebody can call it back later if they need the data.
Which, like many things in /\w*[ns][aeiouy]x$/i, is extremely efficient but
potentially disastrous for the uninformed.
Cheers
-Ted

On Mon, Dec 21, 2009 at 9:03 AM, Dop Ganger <nslug at fop.ns.ca> wrote:

> On Sat, 19 Dec 2009, Brian Wood wrote:
>
>  Also I'd like to find someone willing to give me an account
>> on a big-endian machine.  I'm willing to give that person
>> investments in Ebenezer Enterprises in exchange.
>>
>
> I'm looking to get rid of all my old sparc equipment (Classics, 1, 5, I
> think a 10); if you're willing to come up to Clayton Park and cart away
> 15-20 boxes they're your's for the taking away and never bringing back. At
> least 3 of them work, probably more if you take the time to reassemble all
> the parts. There's also some odds and ends of supporting hardware like
> tape drives, hard drives, etc. I also have a couple of HP PA Risc
> workstations I can throw in for novelty value.
>
> Cheers... Dop.
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/mailman/listinfo/nslug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nslug.ns.ca/mailman/private/nslug/attachments/20091221/33374b73/attachment-0002.html>


More information about the nSLUG mailing list