From c9565a8771b358cfc2de36c8869899a9ff14763f Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 27 Apr 2017 20:49:01 +0200 Subject: [PATCH] added urxvt paste support --- urxvt/.Xdefaults | 6 ++++++ urxvt/bin/urxvt/perl/clipboard | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 urxvt/bin/urxvt/perl/clipboard diff --git a/urxvt/.Xdefaults b/urxvt/.Xdefaults index 8bd4c9e..932d169 100644 --- a/urxvt/.Xdefaults +++ b/urxvt/.Xdefaults @@ -57,6 +57,12 @@ URxvt.pointerBlank: true #*background: #002b36 *shading: 20 +# Enable paste support +URxvt.perl-lib: /home/alrayyes/bin/urxvt/perl +URxvt.keysym.Shift-Control-V: perl:clipboard:paste +URxvt.iso14755: False +URxvt.perl-ext-common: default,clipboard + *foreground: #657b83 !!*fading: 40 *fadeColor: #002b36 diff --git a/urxvt/bin/urxvt/perl/clipboard b/urxvt/bin/urxvt/perl/clipboard new file mode 100755 index 0000000..1aed529 --- /dev/null +++ b/urxvt/bin/urxvt/perl/clipboard @@ -0,0 +1,19 @@ +#script to copy/paste text in URXVT +#! perl +sub on_sel_grab { + my $query = $_[0]->selection; + open (my $pipe,'| /usr/bin/xclip -in -selection clipboard') or die; + print $pipe $query; + close $pipe; +} +sub paste { + my ($self) = @_; + my $content = `/usr/bin/xclip -loop 1 -out -selection clipboard` ; + $self->tt_write ($content); +} +sub on_user_command { + my ($self, $cmd) = @_; + if ($cmd eq "clipboard:paste") { + $self->paste; + } +}