summaryrefslogtreecommitdiffstats
path: root/src/perl/clipboard-osc
blob: 58d3c2bc80058e625b58258502e15e264ba69136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! perl

=head1 NAME

clipboard-osc - implement the clipboard operating system command sequence

=head1 SYNOPSIS

   urxvt -pe clipboard-osc

=head1 DESCRIPTION

This extension implements the clipboard;copy Perl OSC.

=cut


sub on_osc_seq_perl {
   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
}