Created
October 6, 2015 11:45
-
-
Save xkr47/98224ed6b0860cb55ec0 to your computer and use it in GitHub Desktop.
rxvt-unicode: Enable Ctrl-Insert/Ctrl-Shift-c to copy to CLIPBOARD (as opposed to PRIMARY) selection. Pasting works by Meta-<middle button>
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
#! perl | |
# Store this file as /usr/lib/urxvt/perl/xkr-clipboard | |
# | |
# To enable, add to ~/.Xresources: | |
# | |
# URxvt.perl-ext-common: default,xkr-clipboard | |
# URxvt.iso14755: false | |
# URxvt.keysym.Shift-Control-C: perl:clipboard:copy | |
# URxvt.keysym.Control-Insert: perl:clipboard:copy | |
# | |
# Based on | |
# https://wiki.archlinux.org/index.php/Rxvt-unicode#Custom_key_bindings | |
# rxvt-unicode-9.19 / src/perl/clipboard-osc | |
sub on_user_command { | |
my ($self, $osc, $resp) = @_; | |
return unless $osc =~ s/^clipboard:([^;]+)//; | |
if ($1 eq "copy") { | |
my $text = $self->selection (); | |
$self->selection ($text, 1); | |
$self->selection_grab (urxvt::CurrentTime, 1); | |
} | |
1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment