ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/overlay-osc
(Generate patch)

Comparing rxvt-unicode/src/perl/overlay-osc (file contents):
Revision 1.1 by root, Fri Oct 10 00:11:40 2008 UTC vs.
Revision 1.4 by root, Sun Jun 10 17:31:53 2012 UTC

1#! perl 1#! perl
2
3=head1 NAME
4
5 overlay-osc - implement OSC to manage overlays
6
7=head1 DESCRPTION
8
9This extension implements some OSC commands to display timed popups on the
10screen - useful for status displays from within scripts. You have to read
11the sources for more info.
12
13=cut
2 14
3# allows programs to open popups 15# allows programs to open popups
4# printf "\033]777;overlay;action;args\007" 16# printf "\033]777;overlay;action;args\007"
5# 17#
6# action "simple;<id>;<x>;<y>;<h|t>;<text>" 18# action "simple;<id>;<timeout>;<x>;<y>;<h|t>;<text>"
7# printf "\033]777;overlay;simple;ov1;0;0;t;test\007" 19# printf "\033]777;overlay;simple;ov1;5;0;0;t;test\007"
8# 20#
9## action "complex;<id>;<x>;<y>;<w>;<h>;<rstyle>;<border>;<h|t>;<text>"
10 21
11# action "timeout;<id>;<seconds>" 22# action "timeout;<id>;<seconds>"
12# printf "\033]777;overlay;timeout;ov1;6\007" 23# printf "\033]777;overlay;timeout;ov1;6\007"
13 24
14# action "destroy;<id>" 25# action "destroy;<id>"
26# printf "\033]777;overlay;destroy;ov1\007"
27
28# TODO:
29## action "complex;<id>;<timeout>;<x>;<y>;<width>;<height>;<rstyle>;<border>"
30## action "set;<id>;<x>;<y>;<h|t>;<hextext>;<rendition...>"
15 31
16sub on_osc_seq_perl { 32sub on_osc_seq_perl {
17 my ($self, $osc, $resp) = @_; 33 my ($self, $osc, $resp) = @_;
18 34
19 return unless $osc =~ s/^overlay;//; 35 return unless $osc =~ s/^overlay;//;
30 } else { 46 } else {
31 delete $ov->{to}; 47 delete $ov->{to};
32 } 48 }
33 49
34 } elsif ($1 eq "simple") { 50 } elsif ($1 eq "simple") {
35 my ($id, $x, $y, $t, $txt) = split /;/, $osc, 5; 51 my ($id, $to, $x, $y, $t, $txt) = split /;/, $osc, 6;
36 if ($t eq "h") { 52 if ($t eq "h") {
37 $txt = pack "H*", $txt; 53 $txt = pack "H*", $txt;
38 utf8::decode $txt; 54 utf8::decode $txt;
39 } 55 }
40 $self->{ov}{$id} = { 56 $self->{ov}{$id} = {
41 ov => $self->overlay_simple ($x, $y, $txt), 57 ov => $self->overlay_simple ($x, $y, $txt),
42 to => urxvt::timer 58 to => urxvt::timer
43 ->new 59 ->new
44 ->start (urxvt::NOW + 60) 60 ->start (urxvt::NOW + $to)
45 ->cb(sub { 61 ->cb(sub {
46 delete $self->{ov}{$id}; 62 delete $self->{ov}{$id};
47 }), 63 }),
48 }; 64 };
49 65

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines