Skip to content

Instantly share code, notes, and snippets.

@aronj
Last active November 20, 2016 15:17
Show Gist options
  • Save aronj/79cd4ae3cef39cba5861377dad50e2ea to your computer and use it in GitHub Desktop.
Save aronj/79cd4ae3cef39cba5861377dad50e2ea to your computer and use it in GitHub Desktop.
urxvt selection to clipboard
#!/usr/bin/env perl
# save as /usr/lib/urxvt/perl/clipboard
# in .Xdefaults: URxvt.perl-ext-common: default,matcher,selection-to-clipboard
sub on_sel_grab {
my $text = quotemeta $_[0]->selection;
$text =~ s/\n/\\n/g;
$text =~ s/\r/\\r/g;
system("echo $text|xclip -i -selection clipboard");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment