Created
April 22, 2016 18:58
-
-
Save AlexCortinas/8f83ccfc4ee56a6098dea32d335fe9d8 to your computer and use it in GitHub Desktop.
urxvt selection to clipboard
This file contains hidden or 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/perl | |
# urxvt selection to system clipboard | |
# Saw in: https://bbs.archlinux.org/viewtopic.php?id=42563 | |
# | |
# Save it to /usr/lib64/urxvt/perl as clipboard | |
# In ~/.Xdefaults, enable it with: | |
# urxvt*perl-ext-common: default,matcher,clipboard | |
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" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment