Thursday, July 24, 2014

CentOS / VirtualBox: copy paste shit from/to Windows and urxvt

#! /usr/bin/perl

sub on_sel_grab {
    my $query = quotemeta $_[0]->selection;
    $query =~ s/\n/\\n/g;
    $query =~ s/\r/\\r/g;
    system( "echo -en " . $query . " | xsel -ibp" );
}
I called it clipboard, saved it to /usr/lib64/urxvt/perl/, and enabled in ~/.Xdefaults:
urxvt*perl-ext-common:      default,matcher,clipboard