updated on Tue Jan 17 08:05:08 UTC 2012
[aur-mirror.git] / urxvt-yac / clipboard
blobe0808a161119d7e4452f6a3be91b004479b09280
1 #! /usr/bin/perl
3 # Usage:
4 # URxvt.perl-ext-common: clipboard
5 # URxvt.keysym.Mod4-c: perl:clipboard:copy
6 # URxvt.keysym.Mod4-v: perl:clipboard:paste
8 # consult command "xmodmap" to see what your modifier mapped into.
10 sub copy {
11 my ($self) = @_;
12 my $pid = open( pout, "| xsel -ib" ) or die "fork";
13 print pout $self->selection;
14 close(pout) or die "close";
17 sub paste {
18 my ($self) = @_;
19 my $content = `xsel -ob` ;
20 $self->tt_write ($content);
23 sub on_user_command {
24 my ($self, $cmd) = @_;
25 if ($cmd eq "clipboard:copy") {
26 $self->copy;
28 if ($cmd eq "clipboard:paste") {
29 $self->paste;