… | |
… | |
3 | #:META:X_RESOURCE:%.expr:string:background expression |
3 | #:META:X_RESOURCE:%.expr:string:background expression |
4 | #:META:X_RESOURCE:%.border.:boolean:respect the terminal border |
4 | #:META:X_RESOURCE:%.border.:boolean:respect the terminal border |
5 | |
5 | |
6 | #TODO: once, rootalign |
6 | #TODO: once, rootalign |
7 | |
7 | |
|
|
8 | =head1 NAME |
|
|
9 | |
8 | =head1 background - manage terminal background |
10 | background - manage terminal background |
9 | |
11 | |
10 | =head2 SYNOPSIS |
12 | =head1 SYNOPSIS |
11 | |
13 | |
12 | urxvt --background-expr 'background expression' |
14 | urxvt --background-expr 'background expression' |
13 | --background-border |
15 | --background-border |
14 | |
16 | |
15 | =head2 DESCRIPTION |
17 | =head1 DESCRIPTION |
16 | |
18 | |
17 | This extension manages the terminal background by creating a picture that |
19 | This extension manages the terminal background by creating a picture that |
18 | is behind the text, replacing the normal background colour. |
20 | is behind the text, replacing the normal background colour. |
19 | |
21 | |
20 | It does so by evaluating a Perl expression that I<calculates> the image on |
22 | It does so by evaluating a Perl expression that I<calculates> the image on |
… | |
… | |
30 | |
32 | |
31 | Or specified as a X resource: |
33 | Or specified as a X resource: |
32 | |
34 | |
33 | URxvt.background-expr: scale load "/path/to/mybg.png" |
35 | URxvt.background-expr: scale load "/path/to/mybg.png" |
34 | |
36 | |
35 | =head2 THEORY OF OPERATION |
37 | =head1 THEORY OF OPERATION |
36 | |
38 | |
37 | At startup, just before the window is mapped for the first time, the |
39 | At startup, just before the window is mapped for the first time, the |
38 | expression is evaluated and must yield an image. The image is then |
40 | expression is evaluated and must yield an image. The image is then |
39 | extended as necessary to cover the whole terminal window, and is set as a |
41 | extended as necessary to cover the whole terminal window, and is set as a |
40 | background pixmap. |
42 | background pixmap. |
… | |
… | |
57 | image to the window size, so it relies on the window size and will |
59 | image to the window size, so it relies on the window size and will |
58 | be reevaluated each time it is changed, but not when it moves for |
60 | be reevaluated each time it is changed, but not when it moves for |
59 | example. That ensures that the picture always fills the terminal, even |
61 | example. That ensures that the picture always fills the terminal, even |
60 | after it's size changes. |
62 | after it's size changes. |
61 | |
63 | |
62 | =head3 EXPRESSIONS |
64 | =head2 EXPRESSIONS |
63 | |
65 | |
64 | Expressions are normal Perl expressions, in fact, they are Perl blocks - |
66 | Expressions are normal Perl expressions, in fact, they are Perl blocks - |
65 | which means you could use multiple lines and statements: |
67 | which means you could use multiple lines and statements: |
66 | |
68 | |
67 | again 3600; |
69 | again 3600; |
… | |
… | |
133 | It first takes a snapshot of the screen background image, and then |
135 | It first takes a snapshot of the screen background image, and then |
134 | moves it to the upper left corner of the screen - the result is |
136 | moves it to the upper left corner of the screen - the result is |
135 | pseudo-transparency, as the image seems to be static while the window is |
137 | pseudo-transparency, as the image seems to be static while the window is |
136 | moved around. |
138 | moved around. |
137 | |
139 | |
138 | =head3 CYCLES AND CACHING |
140 | =head2 CYCLES AND CACHING |
139 | |
141 | |
140 | As has been mentioned before, the expression might be evaluated multiple |
142 | As has been mentioned before, the expression might be evaluated multiple |
141 | times. Each time the expression is reevaluated, a new cycle is said to |
143 | times. Each time the expression is reevaluated, a new cycle is said to |
142 | have begun. Many operators cache their results till the next cycle. |
144 | have begun. Many operators cache their results till the next cycle. |
143 | |
145 | |
… | |
… | |
168 | |
170 | |
169 | Here, a path is selected randomly, and load is only called for one image, |
171 | Here, a path is selected randomly, and load is only called for one image, |
170 | so keeps only one image in memory. If, on the next evaluation, luck |
172 | so keeps only one image in memory. If, on the next evaluation, luck |
171 | decides to use the other path, then it will have to load that image again. |
173 | decides to use the other path, then it will have to load that image again. |
172 | |
174 | |
173 | =head2 REFERENCE |
175 | =head1 REFERENCE |
174 | |
176 | |
175 | =head3 COMMAND LINE SWITCHES |
177 | =head2 COMMAND LINE SWITCHES |
176 | |
178 | |
177 | =over 4 |
179 | =over 4 |
178 | |
180 | |
179 | =item --background-expr perl-expression |
181 | =item --background-expr perl-expression |
180 | |
182 | |
… | |
… | |
262 | |
264 | |
263 | =back |
265 | =back |
264 | |
266 | |
265 | =head2 VARIABLES |
267 | =head2 VARIABLES |
266 | |
268 | |
267 | The following functions provide variable data such as the terminal |
269 | The following functions provide variable data such as the terminal window |
|
|
270 | dimensions. They are not (Perl-) variables, they jsut return stuff that |
268 | window dimensions. Most of them make your expression sensitive to some |
271 | varies. Most of them make your expression sensitive to some events, for |
269 | events, for example using C<TW> (terminal width) means your expression is |
272 | example using C<TW> (terminal width) means your expression is evaluated |
270 | evaluated again when the terminal is resized. |
273 | again when the terminal is resized. |
271 | |
274 | |
272 | =over 4 |
275 | =over 4 |
273 | |
276 | |
274 | =item TX |
277 | =item TX |
275 | |
278 | |