Last active
November 20, 2016 15:17
-
-
Save aronj/79cd4ae3cef39cba5861377dad50e2ea to your computer and use it in GitHub Desktop.
urxvt selection to clipboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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