Skip to content

Instantly share code, notes, and snippets.

@gridsane
Created November 15, 2013 08:42
Show Gist options
  • Save gridsane/7481121 to your computer and use it in GitHub Desktop.
Save gridsane/7481121 to your computer and use it in GitHub Desktop.
urxvt clipboard extension
#script to copy/paste text in URXVT
#copyrights ?
#! 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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment