Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday February 24, 2005
01:20 PM

Linux clipboard tool?

[ #23355 ]

Does anyone know of a Linux utility that will let me redirect STDIN to the clipboard? I've been searching high and low and can't seem to find anything. Essentially, I'm looking for something like pbcopy.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Not what you asked for, but others may be interested. On Windows, it looks like this (run pl2bat on it):
    #!/usr/bin/perl -w
    use strict;
    use Win32::Clipboard;
    Win32::Clipboard->Set( join("", <STDIN>) );
  • xclip [] looks like it does what your looking for
    • Looks perfect, but it's a no-op on my system. It installed just fine, but even the example programs don't do anything :/

    • No error message? Have you tried both reading and writing,maybe your apps are using different buffers to what xclip is expecting.
    • I installed the debian package (from sarge) and the samples seemed to work well for me.

      The debian maintainer added a note to the copyright file ( right) that might interest you.

      "Since Kim Saunders is the upstream author and was the Debian maintainer and was missing, I'm doing upstream type fixes in my own repository which can be seen at:"

  • Cutting is hard, because you need an app that'll "own" the selection, and deal with paste requests.

    Here's a short TCL/Tk script that does it, based on something similar I had for pasting. It's quite suboptimal, but should give the idea. Reimplementing in perl, and incorporating some smart forking and one-daemon-per-desktop code would be really nifty! ;)

    #!/usr/bin/wish -f
    # xcopy - set the current string selection to whatever's passed in on stdin

    set text [read stdin]

    # Set up the data handler ready for