| 1 |
root |
1.1 |
#! perl |
| 2 |
|
|
|
| 3 |
root |
1.10 |
=head1 NAME |
| 4 |
|
|
|
| 5 |
|
|
digital-clock - display a digital clock overlay |
| 6 |
|
|
|
| 7 |
root |
1.11 |
=head1 DESCRIPTION |
| 8 |
root |
1.10 |
|
| 9 |
|
|
Displays a digital clock using the built-in overlay. |
| 10 |
|
|
|
| 11 |
|
|
=cut |
| 12 |
root |
1.1 |
|
| 13 |
root |
1.9 |
sub on_start { |
| 14 |
root |
1.1 |
my ($self) = @_; |
| 15 |
|
|
|
| 16 |
root |
1.7 |
$self->{overlay} = $self->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); |
| 17 |
|
|
$self->{timer} = urxvt::timer |
| 18 |
root |
1.1 |
->new |
| 19 |
root |
1.8 |
->start (1 + int urxvt::NOW) # make sure we update "on" the second |
| 20 |
root |
1.5 |
->interval (1) |
| 21 |
root |
1.1 |
->cb (sub { |
| 22 |
root |
1.7 |
$self->{overlay}->set (0, 0, |
| 23 |
root |
1.5 |
sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
| 24 |
root |
1.1 |
}); |
| 25 |
|
|
|
| 26 |
|
|
() |
| 27 |
|
|
} |
| 28 |
|
|
|
| 29 |
|
|
|