Skip to content

Instantly share code, notes, and snippets.

@AlexCortinas
Created April 22, 2016 18:58
Show Gist options
  • Save AlexCortinas/8f83ccfc4ee56a6098dea32d335fe9d8 to your computer and use it in GitHub Desktop.
Save AlexCortinas/8f83ccfc4ee56a6098dea32d335fe9d8 to your computer and use it in GitHub Desktop.
urxvt selection to clipboard
#! /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