--- rxvt-unicode/src/perl/remote-clipboard 2006/01/25 15:33:43 1.2 +++ rxvt-unicode/src/perl/remote-clipboard 2012/06/10 13:58:06 1.8 @@ -1,5 +1,8 @@ #! perl +#:META:X_RESOURCE:%.store:string:the command used to store the selection +#:META:X_RESOURCE:%.fetch:string:the command used to fetch the selection + use Fcntl (); sub msg { @@ -40,7 +43,7 @@ $self->{iow} = urxvt::iow ->new ->fd (fileno $fh) - ->events (urxvt::EVENT_WRITE) + ->events (urxvt::EV_WRITE) ->start ->cb (sub { if (my $len = syswrite $fh, $txt) { @@ -65,7 +68,7 @@ $self->{iow} = urxvt::iow ->new ->fd (fileno $fh) - ->events (urxvt::EVENT_READ) + ->events (urxvt::EV_READ) ->start ->cb (sub { if (my $len = sysread $fh, $txt, 8192, length $txt) { @@ -75,9 +78,7 @@ $self->selection_clear; $self->selection ($txt); $self->selection_grab (urxvt::CurrentTime); - close $fh; - my $status = $? >> 8; - $self->msg ("selection fetched (status $status)"); + $self->msg ("selection fetched"); } }); } @@ -86,10 +87,10 @@ sub on_start { my ($self) = @_; - $self->{store_cmd} = $self->x_resource ("remote-selection.store") + $self->{store_cmd} = $self->x_resource ("%.store") || "rsh ruth 'cat >/tmp/distributed-selection'"; - $self->{fetch_cmd} = $self->x_resource ("remote-selection.fetch") + $self->{fetch_cmd} = $self->x_resource ("%.fetch") || "rsh ruth 'cat /tmp/distributed-selection'"; push @{ $self->{term}{selection_popup_hook} }, sub { @@ -102,13 +103,4 @@ () } -sub on_user_command { - my ($self, $cmd) = @_; - - if ($cmd eq "selection-pastebin:remote-pastebin") { - $self->upload_paste; - } - - () -}