/usr/bin/clipaccumulate is in libclipboard-perl 0.13-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/usr/bin/perl
use strict;
use Clipboard;
my $END_STRING = 'endEndENDenDend';
my $should_quit = 0;
my $prev = Clipboard->paste;
my $total = '';
warn "To exit, hit ^C, or copy this string into the clipboard: $END_STRING\n";
$SIG{INT} = sub { $should_quit = 1 };
while (1) {
my $cur = Clipboard->paste;
$should_quit = 1 if $cur eq $END_STRING;
last if $should_quit;
if ($prev ne $cur) {
print $cur, ' ';
$total .= $cur . ' ';
}
$prev = $cur;
}
END {
Clipboard->copy($total);
print "\nClipboard accumulated.\n";
}
=head1 NAME
clipaccumulate - Make a bunch of little clipboards into one big one.
=head1 USAGE
The first thing it says (which goes to STDERR, so you can redirect into a file
if you want), is how to exit, which is by copying the magic "end" string into
the clipboard. Crufty? Yep. You can still do Ctrl+C if you don't like this
(or if the string scrolls off the top of the screen).
The next thing it does is wait for the clipboard to change, at which point it
will print out the new data and go back to waiting for the clipboard to
change.
Then you copy the exit string, and it will fill the clipboard with all the
little pieces it saw along the way.
(Right now, it just joins everything with spaces in between - is this bugging
anyone?)
=head1 MOTIVATION
Hard to explain. I run into cases where I wanted to make a bunch of small
notes that included all these different bits of info. Instead of jotting them
down on a scrap of paper, I made this.
Let me know how it can be made better.
=head1 AUTHOR
Ryan King <rking@panoptic.com>
=head1 COPYRIGHT
Copyright (c) 2010. Ryan King. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See L<http://www.perl.com/perl/misc/Artistic.html>
|