… | |
… | |
22 | my ($self) = @_; |
22 | my ($self) = @_; |
23 | |
23 | |
24 | my $time = sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2, 1, 0]; |
24 | my $time = sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2, 1, 0]; |
25 | my $xpos = $self->ncol - length $time; |
25 | my $xpos = $self->ncol - length $time; |
26 | |
26 | |
|
|
27 | $xpos >= 0 |
|
|
28 | or return; |
|
|
29 | |
27 | $self->{digital_clock_rend} = $self->ROW_r (0, [(urxvt::DEFAULT_RSTYLE) x length $time], $xpos); |
30 | $self->{digital_clock_rend} = $self->ROW_r (0, [(urxvt::DEFAULT_RSTYLE) x length $time], $xpos); |
28 | $self->{digital_clock_text} = $self->ROW_t (0, $time, $xpos); |
31 | $self->{digital_clock_text} = $self->ROW_t (0, $time, $xpos); |
29 | |
32 | |
30 | () |
33 | () |
31 | } |
34 | } |
32 | |
35 | |
33 | # after refreshing: restore previous screen contents |
36 | # after refreshing: restore previous screen contents |
34 | sub on_refresh_end { |
37 | sub on_refresh_end { |
35 | my ($self) = @_; |
38 | my ($self) = @_; |
36 | |
39 | |
|
|
40 | exists $self->{digital_clock_text} |
|
|
41 | or return; |
|
|
42 | |
37 | $self->ROW_r (0, $self->{digital_clock_rend}); |
43 | $self->ROW_r (0, delete $self->{digital_clock_rend}); |
38 | $self->ROW_t (0, $self->{digital_clock_text}); |
44 | $self->ROW_t (0, delete $self->{digital_clock_text}); |
39 | |
45 | |
40 | () |
46 | () |
41 | } |
47 | } |
42 | |
48 | |
43 | |
49 | |