aboutsummaryrefslogtreecommitdiff
path: root/urxvt/ext
diff options
context:
space:
mode:
Diffstat (limited to 'urxvt/ext')
-rw-r--r--urxvt/ext/clip22
1 files changed, 22 insertions, 0 deletions
diff --git a/urxvt/ext/clip b/urxvt/ext/clip
new file mode 100644
index 00000000..ce698328
--- /dev/null
+++ b/urxvt/ext/clip
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+
+# Copy PRIMARY selections to the clipboard too with xsel(1).
+
+use strict;
+use warnings;
+
+sub on_start {
+ my ($self) = @_;
+ $self->enable( sel_grab => \&clip );
+ return;
+}
+
+sub clip {
+ my ($self) = @_;
+ if ( open CLIPBOARD, '| xsel -ib' ) {
+ print CLIPBOARD $self->selection();
+ close CLIPBOARD;
+ }
+ return;
+}
+