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.7 by root, Sat Jul 24 11:58:27 2021 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines