… | |
… | |
4 | #:META:X_RESOURCE:%.border:boolean:respect the terminal border |
4 | #:META:X_RESOURCE:%.border:boolean:respect the terminal border |
5 | #:META:X_RESOURCE:%.interval:seconds:minimum time between updates |
5 | #:META:X_RESOURCE:%.interval:seconds:minimum time between updates |
6 | |
6 | |
7 | =head1 NAME |
7 | =head1 NAME |
8 | |
8 | |
9 | background - manage terminal background |
9 | background - manage terminal background |
10 | |
10 | |
11 | =head1 SYNOPSIS |
11 | =head1 SYNOPSIS |
12 | |
12 | |
13 | urxvt --background-expr 'background expression' |
13 | urxvt --background-expr 'background expression' |
14 | --background-border |
14 | --background-border |
15 | --background-interval seconds |
15 | --background-interval seconds |
|
|
16 | |
|
|
17 | =head1 QUICK AND DIRTY CHEAT SHEET |
|
|
18 | |
|
|
19 | Just load a random jpeg image and tile the background with it without |
|
|
20 | scaling or anything else: |
|
|
21 | |
|
|
22 | load "/path/to/img.jpg" |
|
|
23 | |
|
|
24 | The same, but use mirroring/reflection instead of tiling: |
|
|
25 | |
|
|
26 | mirror load "/path/to/img.jpg" |
|
|
27 | |
|
|
28 | Load an image and scale it to exactly fill the terminal window: |
|
|
29 | |
|
|
30 | scale keep { load "/path/to/img.jpg" } |
|
|
31 | |
|
|
32 | Implement pseudo-transparency by using a suitably-aligned root pixmap |
|
|
33 | as window background: |
|
|
34 | |
|
|
35 | rootalign root |
|
|
36 | |
|
|
37 | Likewise, but keep a blurred copy: |
|
|
38 | |
|
|
39 | rootalign keep { blur 10, root } |
16 | |
40 | |
17 | =head1 DESCRIPTION |
41 | =head1 DESCRIPTION |
18 | |
42 | |
19 | This extension manages the terminal background by creating a picture that |
43 | This extension manages the terminal background by creating a picture that |
20 | is behind the text, replacing the normal background colour. |
44 | is behind the text, replacing the normal background colour. |
… | |
… | |
398 | for @_; |
422 | for @_; |
399 | |
423 | |
400 | $base |
424 | $base |
401 | } |
425 | } |
402 | |
426 | |
|
|
427 | =back |
|
|
428 | |
403 | =head2 TILING MODES |
429 | =head2 TILING MODES |
404 | |
430 | |
405 | The following operators modify the tiling mode of an image, that is, the |
431 | The following operators modify the tiling mode of an image, that is, the |
406 | way that pixels outside the image area are painted when the image is used. |
432 | way that pixels outside the image area are painted when the image is used. |
407 | |
433 | |
… | |
… | |
509 | |
535 | |
510 | move -TX, -TY, keep { load "mybg.png" } |
536 | move -TX, -TY, keep { load "mybg.png" } |
511 | |
537 | |
512 | =item TW |
538 | =item TW |
513 | |
539 | |
|
|
540 | =item TH |
|
|
541 | |
514 | Return the width (C<TW>) and height (C<TH>) of the terminal window (the |
542 | Return the width (C<TW>) and height (C<TH>) of the terminal window (the |
515 | terminal window is the full window by default, and the character area only |
543 | terminal window is the full window by default, and the character area only |
516 | when in border-respect mode). |
544 | when in border-respect mode). |
517 | |
545 | |
518 | Using these functions make your expression sensitive to window resizes. |
546 | Using these functions make your expression sensitive to window resizes. |
… | |
… | |
585 | Clips an image to the given rectangle. If the rectangle is outside the |
613 | Clips an image to the given rectangle. If the rectangle is outside the |
586 | image area (e.g. when C<$x> or C<$y> are negative) or the rectangle is |
614 | image area (e.g. when C<$x> or C<$y> are negative) or the rectangle is |
587 | larger than the image, then the tiling mode defines how the extra pixels |
615 | larger than the image, then the tiling mode defines how the extra pixels |
588 | will be filled. |
616 | will be filled. |
589 | |
617 | |
590 | If C<$x> an C<$y> are missing, then C<0> is assumed for both. |
618 | If C<$x> and C<$y> are missing, then C<0> is assumed for both. |
591 | |
619 | |
592 | If C<$width> and C<$height> are missing, then the window size will be |
620 | If C<$width> and C<$height> are missing, then the window size will be |
593 | assumed. |
621 | assumed. |
594 | |
622 | |
595 | Example: load an image, blur it, and clip it to the window size to save |
623 | Example: load an image, blur it, and clip it to the window size to save |
… | |
… | |
827 | latter in a white picture. |
855 | latter in a white picture. |
828 | |
856 | |
829 | Due to idiosyncrasies in the underlying XRender extension, biases less |
857 | Due to idiosyncrasies in the underlying XRender extension, biases less |
830 | than zero can be I<very> slow. |
858 | than zero can be I<very> slow. |
831 | |
859 | |
|
|
860 | You can also try the experimental(!) C<muladd> operator. |
|
|
861 | |
832 | =cut |
862 | =cut |
833 | |
863 | |
834 | sub contrast($$;$$;$) { |
864 | sub contrast($$;$$;$) { |
835 | my $img = pop; |
865 | my $img = pop; |
836 | my ($r, $g, $b, $a) = @_; |
866 | my ($r, $g, $b, $a) = @_; |
… | |
… | |
851 | $a = 1 if @_ < 4; |
881 | $a = 1 if @_ < 4; |
852 | |
882 | |
853 | $img = $img->clone; |
883 | $img = $img->clone; |
854 | $img->brightness ($r, $g, $b, $a); |
884 | $img->brightness ($r, $g, $b, $a); |
855 | $img |
885 | $img |
|
|
886 | } |
|
|
887 | |
|
|
888 | =item muladd $mul, $add, $img # EXPERIMENTAL |
|
|
889 | |
|
|
890 | First multiplies the pixels by C<$mul>, then adds C<$add>. This can be used |
|
|
891 | to implement brightness and contrast at the same time, with a wider value |
|
|
892 | range than contrast and brightness operators. |
|
|
893 | |
|
|
894 | Due to numerous bugs in XRender implementations, it can also introduce a |
|
|
895 | number of visual artifacts. |
|
|
896 | |
|
|
897 | Example: increase contrast by a factor of C<$c> without changing image |
|
|
898 | brightness too much. |
|
|
899 | |
|
|
900 | muladd $c, (1 - $c) * 0.5, $img |
|
|
901 | |
|
|
902 | =cut |
|
|
903 | |
|
|
904 | sub muladd($$$) { |
|
|
905 | $_[2]->muladd ($_[0], $_[1]) |
856 | } |
906 | } |
857 | |
907 | |
858 | =item blur $radius, $img |
908 | =item blur $radius, $img |
859 | |
909 | |
860 | =item blur $radius_horz, $radius_vert, $img |
910 | =item blur $radius_horz, $radius_vert, $img |