ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/remote-clipboard
(Generate patch)

Comparing rxvt-unicode/src/perl/remote-clipboard (file contents):
Revision 1.5 by root, Sun Nov 11 04:08:00 2007 UTC vs.
Revision 1.12 by root, Tue Sep 4 22:41:12 2012 UTC

1#! perl 1#! perl
2
3#:META:X_RESOURCE:%.store:string:the command used to store the selection
4#:META:X_RESOURCE:%.fetch:string:the command used to fetch the selection
5
6=head1 NAME
7
8remote-clipboard - manage a shared and possibly remote clipboard
9
10=head1 DESCRIPTION
11
12Somewhat of a misnomer, this extension adds two menu entries to the
13selection popup that allows one to run external commands to store the
14selection somewhere and fetch it again.
15
16We use it to implement a "distributed selection mechanism", which just
17means that one command uploads the file to a remote server, and another
18reads it.
19
20The commands can be set using the C<URxvt.remote-selection.store> and
21C<URxvt.remote-selection.fetch> resources. The first should read the
22selection to store from STDIN (always in UTF-8), the second should provide
23the selection data on STDOUT (also in UTF-8).
24
25The defaults (which are likely useless to you) use rsh and cat:
26
27 URxvt.remote-selection.store: rsh ruth 'cat >/tmp/distributed-selection'
28 URxvt.remote-selection.fetch: rsh ruth 'cat /tmp/distributed-selection'
29
30=cut
2 31
3use Fcntl (); 32use Fcntl ();
4 33
5sub msg { 34sub msg {
6 my ($self, $msg) = @_; 35 my ($self, $msg) = @_;
82} 111}
83 112
84sub on_start { 113sub on_start {
85 my ($self) = @_; 114 my ($self) = @_;
86 115
87 $self->{store_cmd} = $self->x_resource ("remote-selection.store") 116 $self->{store_cmd} = $self->x_resource ("%.store")
88 || "rsh ruth 'cat >/tmp/distributed-selection'"; 117 || "rsh ruth 'cat >/tmp/distributed-selection'";
89 118
90 $self->{fetch_cmd} = $self->x_resource ("remote-selection.fetch") 119 $self->{fetch_cmd} = $self->x_resource ("%.fetch")
91 || "rsh ruth 'cat /tmp/distributed-selection'"; 120 || "rsh ruth 'cat /tmp/distributed-selection'";
92 121
93 push @{ $self->{term}{selection_popup_hook} }, sub { 122 push @{ $self->{term}{selection_popup_hook} }, sub {
94 ("selection => remote" => sub { $self->store }) 123 ("selection => remote" => sub { $self->store })
95 }; 124 };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines