1
0
mirror of https://github.com/alrayyes/server-dotfiles synced 2023-11-14 15:56:25 +00:00
server-dotfiles/urxvt/bin/urxvt/perl/clipboard
2017-04-27 20:49:01 +02:00

20 lines
465 B
Plaintext
Executable File

#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;
}
}