You are not logged in.

#1 2007-09-06 05:46:30

synthead
Member
Registered: 2006-05-09
Posts: 1,337

stuff > (clipboard?) [solved]

Is there a way I can send the output of a command to the clipboard?  For example, when putting together a package for the AUR, I want to get some md5sums.  So I'll "md5sum [file] > md5" to later open it up in a text editor and copy it.  I would much rather be able to just md5 file > clipboard and just paste it!  Is this possible?

Last edited by synthead (2007-09-11 06:35:12)

Offline

#2 2007-09-06 07:11:22

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: stuff > (clipboard?) [solved]

I'd be interested in a way to achieve this as well.

For your particular problem: makepkg -g >> PKGBUILD is just fine. But remember to move those md5sums to the right place in the PKGBUILD.


Hail to the thief!

Offline

#3 2007-09-06 08:25:12

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: stuff > (clipboard?) [solved]

harlekin wrote:

I'd be interested in a way to achieve this as well.

For your particular problem: makepkg -g >> PKGBUILD is just fine. But remember to move those md5sums to the right place in the PKGBUILD.

Location does not matter, and no order is defined for PKGBUILD fields. I personally prefer md5sums at the end. You rarely edit them manually -- and you always autogen them.

James

Offline

#4 2007-09-06 13:13:03

MrWeatherbee
Member
Registered: 2007-08-01
Posts: 277

Re: stuff > (clipboard?) [solved]

synthead wrote:

Is there a way I can send the output of a command to the clipboard?  For example, when putting together a package for the AUR, I want to get some md5sums.  So I'll "md5sum [file] > md5" to later open it up in a text editor and copy it.  I would much rather be able to just md5 file > clipboard and just paste it!  Is this possible?

Yes. You can do it very easily using 'xsel'. It is in community.

Example:

md5sum '/path/to/file/archbannerglass3.jpg' | xsel -i

places this:

91e843907f5d63e49617c4ae8cacf130  /path/to/file/archbannerglass3.jpg

on the X PRIMARY selection (PRIMARY is default). So, middle-clicking will then paste that wherever you like.

To switch to the SECONDARY selection or CLIPBOARD selection, use the -s or -b options, respectively. I'm not familiar with what SECONDARY does, to be honest, but placing the item on the CLIPBOARD selection allows for pasting via the right-click context menu or via CTRL+v.

Note:
When testing xsel's capabilities, you might want to clear the selections between each operation using -c in association with whatever selection option was used to capture the selection, e.g.:

xsel -c
#or
xsel -p -c

clears the PRIMARY selection, and

xsel -b -c

clears the CLIPBOARD selection.

You also might want to temporarily disable things like Glipper and Klipper during your testing just to be sure you don't get confused about  whether a copy operation came from xsel or from Glipper or Klipper (i.e., the clear command, rightfully so, will not remove anything from Glipper or Klipper).

Finally, here's some nice background info on X selection operations:

http://www.jwz.org/doc/x-cut-and-paste.html

Last edited by MrWeatherbee (2007-09-06 13:32:06)

Offline

#5 2007-09-10 07:03:22

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: stuff > (clipboard?) [solved]

MrWeatherbee wrote:
synthead wrote:

Is there a way I can send the output of a command to the clipboard?  For example, when putting together a package for the AUR, I want to get some md5sums.  So I'll "md5sum [file] > md5" to later open it up in a text editor and copy it.  I would much rather be able to just md5 file > clipboard and just paste it!  Is this possible?

Yes. You can do it very easily using 'xsel'. It is in community.

Example:

md5sum '/path/to/file/archbannerglass3.jpg' | xsel -i

places this:

91e843907f5d63e49617c4ae8cacf130  /path/to/file/archbannerglass3.jpg

on the X PRIMARY selection (PRIMARY is default). So, middle-clicking will then paste that wherever you like.

To switch to the SECONDARY selection or CLIPBOARD selection, use the -s or -b options, respectively. I'm not familiar with what SECONDARY does, to be honest, but placing the item on the CLIPBOARD selection allows for pasting via the right-click context menu or via CTRL+v.

Note:
When testing xsel's capabilities, you might want to clear the selections between each operation using -c in association with whatever selection option was used to capture the selection, e.g.:

xsel -c
#or
xsel -p -c

clears the PRIMARY selection, and

xsel -b -c

clears the CLIPBOARD selection.

You also might want to temporarily disable things like Glipper and Klipper during your testing just to be sure you don't get confused about  whether a copy operation came from xsel or from Glipper or Klipper (i.e., the clear command, rightfully so, will not remove anything from Glipper or Klipper).

Finally, here's some nice background info on X selection operations:

http://www.jwz.org/doc/x-cut-and-paste.html

Yes!  That's exactly what I needed.  Perfect!  Takes care of everything else too. big_smile

Makes me a happier camper, thanks smile

Offline

#6 2007-09-10 18:09:47

MrWeatherbee
Member
Registered: 2007-08-01
Posts: 277

Re: stuff > (clipboard?) [solved]

synthead wrote:

Yes!  That's exactly what I needed.  Perfect!  Takes care of everything else too. big_smile

Makes me a happier camper, thanks smile

Oh, hey ... just noticed you replied back.

Glad I could point you in the right direction. 'Xsel' is a pretty handy tool to have around IMO, though I haven't seen it mentioned much at all.

Offline

Board footer

Powered by FluxBB