From 539deef6ed651d14691f6721ccb9979ca6cfc8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 30 Sep 2013 15:53:25 +0200 Subject: wgetpaste support for urxvt. --- .urxvt/extensions/wgetpaste | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .urxvt/extensions/wgetpaste (limited to '.urxvt') diff --git a/.urxvt/extensions/wgetpaste b/.urxvt/extensions/wgetpaste new file mode 100644 index 0000000..7462319 --- /dev/null +++ b/.urxvt/extensions/wgetpaste @@ -0,0 +1,26 @@ +#! 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 { ("Pastebin" => \&wgetpaste) } + if `which wgetpast 2> /dev/null`; + + return () +} + +sub wgetpaste { + my ($pout, $pin); + + my $pid = open2($pout, $pin, 'wgetpaste'); + print $pin $_; + close $pin; + + $_ = <$pout>; + + s/^.*?://; +} -- cgit v1.2.3