1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | our $EXPR = 'move load "/root/pix/das_fette_schwein.jpg", repeat_wrap, X, Y'; |
3 | our $EXPR = 'move load "/root/pix/das_fette_schwein.jpg", repeat_wrap, X, Y'; |
4 | $EXPR = ' |
4 | $EXPR = ' |
5 | blur 10, 10, |
|
|
6 | rotate W, H, 50, 50, counter 1/60, repeat_mirror, |
5 | rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, |
7 | clip X, Y, W, H, repeat_mirror, |
6 | clip X, Y, W, H, repeat_mirror, |
8 | load "/root/pix/das_fette_schwein.jpg" |
7 | load "/root/pix/das_fette_schwein.jpg" |
9 | '; |
8 | '; |
10 | #$EXPR = 'blur root, 10, 10' |
9 | #$EXPR = 'blur root, 10, 10' |
11 | #$EXPR = 'blur move (root, -x, -y), 5, 5' |
10 | #$EXPR = 'blur move (root, -x, -y), 5, 5' |
… | |
… | |
14 | use Safe; |
13 | use Safe; |
15 | |
14 | |
16 | our ($bgdsl_self, $old, $new); |
15 | our ($bgdsl_self, $old, $new); |
17 | our ($l, $t, $w, $h); |
16 | our ($l, $t, $w, $h); |
18 | |
17 | |
|
|
18 | our $MIN_INTERVAL = 1/60; |
|
|
19 | |
19 | { |
20 | { |
20 | package urxvt::bgdsl; # background language |
21 | package urxvt::bgdsl; # background language |
21 | |
22 | |
22 | *repeat_black = \&urxvt::RepeatNone; #TODO wtf |
23 | *repeat_black = \&urxvt::RepeatNone; #TODO wtf |
23 | *repeat_wrap = \&urxvt::RepeatNormal; |
24 | *repeat_wrap = \&urxvt::RepeatNormal; |
… | |
… | |
29 | |
30 | |
30 | $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path); |
31 | $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path); |
31 | } |
32 | } |
32 | |
33 | |
33 | sub root() { |
34 | sub root() { |
|
|
35 | $new->{rootpmap_sensitive} = 1; |
34 | die "root op not supported, exg, we need you"; |
36 | die "root op not supported, exg, we need you"; |
35 | } |
37 | } |
36 | |
38 | |
37 | # sub clone($) { |
39 | # sub clone($) { |
38 | # $_[0]->clone |
40 | # $_[0]->clone |
… | |
… | |
135 | |
137 | |
136 | # evaluate the current bg expression |
138 | # evaluate the current bg expression |
137 | sub recalculate { |
139 | sub recalculate { |
138 | my ($self) = @_; |
140 | my ($self) = @_; |
139 | |
141 | |
|
|
142 | if ($self->{next_refresh} > urxvt::NOW) { |
|
|
143 | $self->{next_refresh_timer} = urxvt::timer->new->after ($self->{next_refresh} - urxvt::NOW)->cb (sub { |
|
|
144 | $self->recalculate; |
|
|
145 | }); |
|
|
146 | } |
|
|
147 | |
|
|
148 | $self->{next_refresh} = urxvt::NOW + $MIN_INTERVAL; |
|
|
149 | |
140 | #TODO: rate limit calls |
150 | #TODO: rate limit calls |
141 | |
151 | |
142 | local $bgdsl_self = $self; |
152 | local $bgdsl_self = $self; |
143 | |
153 | |
144 | local $old = $self->{state}; |
154 | local $old = $self->{state}; |
… | |
… | |
174 | $self->enable (size_change => sub { $_[0]->recalculate }); |
184 | $self->enable (size_change => sub { $_[0]->recalculate }); |
175 | } else { |
185 | } else { |
176 | $self->disable ("size_change"); |
186 | $self->disable ("size_change"); |
177 | } |
187 | } |
178 | |
188 | |
|
|
189 | if (delete $state->{rootpmap_sensitive}) { |
|
|
190 | $repeat = 1; |
|
|
191 | $self->enable (rootpmap_change => sub { $_[0]->recalculate }); |
|
|
192 | } else { |
|
|
193 | $self->disable ("rootpmap_change"); |
|
|
194 | } |
|
|
195 | |
179 | %$old = (); |
196 | %$old = (); |
180 | |
197 | |
181 | unless ($repeat) { |
198 | unless ($repeat) { |
182 | delete $self->{state}; |
199 | delete $self->{state}; |
183 | delete $self->{expr}; |
200 | delete $self->{expr}; |