[linux-elitists] fun with xsel

Nick 'Sharkey' Moore sharkey@zoic.org
Thu Jan 23 22:10:44 PST 2003


On Fri, Jan 17, 2003 at 03:59:47PM -0800, Don Marti wrote:
> So how many times has this happened to you?  You're logged into
> a remote server reading mail in Mutt and there's an attached file
> you want to take a look at.

Nifty.  I'd never thought of using the X selection buffers for
this kind of thing!

Here's a somewhat simplied version, which doesn't rely
on 'file -i' to work, although it does depend on the sender
being honest about mime types:

-----8<-----ss2
#!/bin/bash
# call with ss2 <mimetype> [<filename>]
# eg: mailcap entry "image/*; ss2 %t %s"
( 
        echo $1
	uuencode $2 $2
) | xsel -s
-----8<-----

-----8<-----viewss
#!/bin/bash
xsel -o -s | (
        read MIMETYPE
	uufilter -s | run-mailcap --action=view $MIMETYPE:-
)
-----8<-----

So, we now have two non-interoperable and largely undocumented
versions of the same idea -- hurrah!

-----sharks



More information about the linux-elitists mailing list