#! perl -w # Adds an entry to the selection popup allowing to move the current selection # to a pastebin via wgetpaste. use IPC::Open2; sub on_start { my ($self) = @_; push @{ $self->{term}{selection_popup_hook} }, sub { `which wgetpaste 2> /dev/null` ? ("Pastebin" => \&wgetpaste) : () }; return () } sub wgetpaste { my ($pout, $pin); my $pid = open2($pout, $pin, 'wgetpaste'); print $pin $_; close $pin; # selection-popup expects the final text in $_ ($_ = <$pout>) =~ s/^.*?://; }