1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | #:META:RESOURCE:$$:string:background expression |
3 | #:META:X_RESOURCE:%.expr:string:background expression |
4 | #:META:RESOURCE:$$-enable:boolean:some boolean |
4 | #:META:X_RESOURCE:%.enable:boolean:some boolean |
|
|
5 | #:META:X_RESOURCE:%.extra.:value:extra config |
5 | |
6 | |
6 | our $EXPR = 'move load "/root/pix/das_fette_schwein.jpg", repeat_wrap, X, Y'; |
7 | our $EXPR = 'move X, Y, load "MagnoliaAlpha.png"'; |
7 | $EXPR = ' |
8 | #$EXPR = ' |
8 | rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, |
9 | # rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, |
9 | clip X, Y, W, H, repeat_mirror, |
10 | # clip X, Y, W, H, repeat_mirror, |
10 | load "/root/pix/das_fette_schwein.jpg" |
11 | # load "/root/pix/das_fette_schwein.jpg" |
11 | '; |
12 | #'; |
12 | $EXPR = 'solid "red"'; |
13 | #$EXPR = 'solid "red"'; |
13 | #$EXPR = 'blur root, 10, 10' |
14 | #$EXPR = 'blur root, 10, 10' |
14 | #$EXPR = 'blur move (root, -x, -y), 5, 5' |
15 | #$EXPR = 'blur move (root, -x, -y), 5, 5' |
15 | #resize load "/root/pix/das_fette_schwein.jpg", w, h |
16 | #resize load "/root/pix/das_fette_schwein.jpg", w, h |
16 | |
17 | |
17 | use Safe; |
18 | use Safe; |
18 | |
19 | |
19 | our ($bgdsl_self, $old, $new); |
20 | our ($bgdsl_self, $old, $new); |
20 | our ($l, $t, $w, $h); |
21 | our ($l, $t, $w, $h); |
21 | |
22 | |
22 | # enforce at leats this time between updates |
23 | # enforce at least this interval between updates |
23 | our $MIN_INTERVAL = 1/100; |
24 | our $MIN_INTERVAL = 1/100; |
24 | |
25 | |
25 | { |
26 | { |
26 | package urxvt::bgdsl; # background language |
27 | package urxvt::bgdsl; # background language |
27 | |
28 | |
28 | *repeat_black = \&urxvt::RepeatNone; #TODO wtf |
29 | # *repeat_empty = \&urxvt::RepeatNone; |
29 | *repeat_wrap = \&urxvt::RepeatNormal; |
30 | # *repeat_tile = \&urxvt::RepeatNormal; |
30 | *repeat_pad = \&urxvt::RepeatPad; |
31 | # *repeat_pad = \&urxvt::RepeatPad; |
31 | *repeat_mirror = \&urxvt::RepeatReflect; |
32 | # *repeat_mirror = \&urxvt::RepeatReflect; |
32 | |
33 | |
33 | =head2 PROVIDERS/GENERATORS |
34 | =head2 PROVIDERS/GENERATORS |
34 | |
35 | |
35 | =over 4 |
36 | =over 4 |
36 | |
37 | |
… | |
… | |
55 | $img |
56 | $img |
56 | } |
57 | } |
57 | |
58 | |
58 | =back |
59 | =back |
59 | |
60 | |
|
|
61 | =head2 VARIABLES |
|
|
62 | |
|
|
63 | =over 4 |
|
|
64 | |
|
|
65 | =cut |
|
|
66 | |
|
|
67 | sub X() { $new->{position_sensitive} = 1; $l } |
|
|
68 | sub Y() { $new->{position_sensitive} = 1; $t } |
|
|
69 | sub W() { $new->{size_sensitive} = 1; $w } |
|
|
70 | sub H() { $new->{size_sensitive} = 1; $h } |
|
|
71 | |
|
|
72 | sub now() { urxvt::NOW } |
|
|
73 | |
|
|
74 | sub again($) { |
|
|
75 | $new->{again} = $_[0]; |
|
|
76 | } |
|
|
77 | |
|
|
78 | sub counter($) { |
|
|
79 | $new->{again} = $_[0]; |
|
|
80 | $bgdsl_self->{counter} + 0 |
|
|
81 | } |
|
|
82 | |
|
|
83 | =back |
|
|
84 | |
60 | =head2 OPERATORS |
85 | =head2 OPERATORS |
61 | |
86 | |
62 | =over 4 |
87 | =over 4 |
63 | |
88 | |
64 | =cut |
89 | =cut |
65 | |
90 | |
66 | # sub clone($) { |
91 | # sub clone($) { |
67 | # $_[0]->clone |
92 | # $_[0]->clone |
68 | # } |
93 | # } |
69 | |
94 | |
70 | sub clip($$$$$;$) { |
95 | sub clip($;$$;$$) { |
71 | my $img = pop; |
96 | my $img = pop; |
72 | $img->sub_rect ($_[0], $_[1], $_[2], $_[3], $_[4]) |
97 | $img->sub_rect ($_[0], $_[1], $_[2] || W, $_[3] || H) |
73 | } |
98 | } |
74 | |
99 | |
75 | sub resize($$$) { |
100 | sub resize($$$) { |
76 | my $img = pop; |
101 | my $img = pop; |
77 | $img->scale ($_[0], $_[1]) |
102 | $img->scale ($_[0], $_[1]) |
78 | } |
103 | } |
79 | |
104 | |
80 | # TODO: ugly |
105 | # TODO: ugly |
81 | sub move($$;$) { |
106 | sub move($$;$) { |
|
|
107 | my $img = pop->clone; |
|
|
108 | $img->move ($_[0], $_[1]); |
|
|
109 | $img |
82 | my $img = pop; |
110 | # my $img = pop; |
83 | $img->sub_rect ( |
111 | # $img->sub_rect ( |
84 | $_[0], $_[1], |
112 | # $_[0], $_[1], |
85 | $img->w, $img->h, |
113 | # $img->w, $img->h, |
86 | $_[2], |
114 | # $_[2], |
87 | ) |
115 | # ) |
88 | } |
116 | } |
89 | |
117 | |
90 | sub rotate($$$$$$;$) { |
118 | sub rotate($$$$$$) { |
91 | my $img = pop; |
119 | my $img = pop; |
92 | $img->rotate ( |
120 | $img->rotate ( |
93 | $_[0], |
121 | $_[0], |
94 | $_[1], |
122 | $_[1], |
95 | $_[2] * $img->w * .01, |
123 | $_[2] * $img->w * .01, |
96 | $_[3] * $img->h * .01, |
124 | $_[3] * $img->h * .01, |
97 | $_[4] * (3.14159265 / 180), |
125 | $_[4] * (3.14159265 / 180), |
98 | $_[5], |
|
|
99 | ) |
126 | ) |
100 | } |
127 | } |
101 | |
128 | |
102 | sub blur($$$) { |
129 | sub blur($$$) { |
103 | my ($rh, $rv, $img) = @_; |
130 | my ($rh, $rv, $img) = @_; |
… | |
… | |
125 | $a = 1 if @_ < 5; |
152 | $a = 1 if @_ < 5; |
126 | |
153 | |
127 | $img = $img->clone; |
154 | $img = $img->clone; |
128 | $img->brightness ($r, $g, $b, $a); |
155 | $img->brightness ($r, $g, $b, $a); |
129 | $img |
156 | $img |
130 | } |
|
|
131 | |
|
|
132 | sub X() { $new->{position_sensitive} = 1; $l } |
|
|
133 | sub Y() { $new->{position_sensitive} = 1; $t } |
|
|
134 | sub W() { $new->{size_sensitive} = 1; $w } |
|
|
135 | sub H() { $new->{size_sensitive} = 1; $h } |
|
|
136 | |
|
|
137 | sub now() { urxvt::NOW } |
|
|
138 | |
|
|
139 | sub again($) { |
|
|
140 | $new->{again} = $_[0]; |
|
|
141 | } |
|
|
142 | |
|
|
143 | sub counter($) { |
|
|
144 | $new->{again} = $_[0]; |
|
|
145 | $bgdsl_self->{counter} + 0 |
|
|
146 | } |
157 | } |
147 | |
158 | |
148 | =back |
159 | =back |
149 | |
160 | |
150 | =cut |
161 | =cut |