ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/background
(Generate patch)

Comparing rxvt-unicode/src/perl/background (file contents):
Revision 1.84 by root, Thu Oct 3 01:11:38 2013 UTC vs.
Revision 1.91 by sf-exg, Thu Jul 7 17:38:34 2016 UTC

1#! perl 1#! perl
2 2
3#:META:X_RESOURCE:%.expr:string:background expression 3#:META:RESOURCE:%.expr:string:background expression
4#:META:X_RESOURCE:%.border:boolean:respect the terminal border 4#:META:RESOURCE:%.border:boolean:respect the terminal border
5#:META:X_RESOURCE:%.interval:seconds:minimum time between updates 5#:META:RESOURCE:%.interval:seconds:minimum time between updates
6 6
7=head1 NAME 7=head1 NAME
8 8
9background - manage terminal background 9background - manage terminal background
10 10
54 54
55 urxvt --background-expr 'scale keep { load "/path/to/mybg.png" }' 55 urxvt --background-expr 'scale keep { load "/path/to/mybg.png" }'
56 56
57Or specified as a X resource: 57Or specified as a X resource:
58 58
59 URxvt.background-expr: scale keep { load "/path/to/mybg.png" } 59 URxvt.background.expr: scale keep { load "/path/to/mybg.png" }
60 60
61=head1 THEORY OF OPERATION 61=head1 THEORY OF OPERATION
62 62
63At startup, just before the window is mapped for the first time, the 63At startup, just before the window is mapped for the first time, the
64expression is evaluated and must yield an image. The image is then 64expression is evaluated and must yield an image. The image is then
132get a percentage): 132get a percentage):
133 133
134 scale 2, load "$HOME/mypic.png" 134 scale 2, load "$HOME/mypic.png"
135 135
136This enlarges the image by a factor of 2 (200%). As you can see, C<scale> 136This enlarges the image by a factor of 2 (200%). As you can see, C<scale>
137has now two arguments, the C<200> and the C<load> expression, while 137has now two arguments, the C<2> and the C<load> expression, while
138C<load> only has one argument. Arguments are separated from each other by 138C<load> only has one argument. Arguments are separated from each other by
139commas. 139commas.
140 140
141Scale also accepts two arguments, which are then separate factors for both 141Scale also accepts two arguments, which are then separate factors for both
142horizontal and vertical dimensions. For example, this halves the image 142horizontal and vertical dimensions. For example, this halves the image
562 562
563A common use case is to fade the background image when the terminal loses 563A common use case is to fade the background image when the terminal loses
564focus, often together with the C<-fade> command line option. In fact, 564focus, often together with the C<-fade> command line option. In fact,
565there is a special function for just that use case: C<focus_fade>. 565there is a special function for just that use case: C<focus_fade>.
566 566
567Example: use two entirely different bacckground images, depending on 567Example: use two entirely different background images, depending on
568whether the window has focus. 568whether the window has focus.
569 569
570 FOCUS ? keep { load "has_focus.jpg" } : keep { load "no_focus.jpg" } 570 FOCUS ? keep { load "has_focus.jpg" } : keep { load "no_focus.jpg" }
571 571
572=cut 572=cut
956=item focus_fade $factor, $img 956=item focus_fade $factor, $img
957 957
958=item focus_fade $factor, $color, $img 958=item focus_fade $factor, $color, $img
959 959
960Fades the image by the given factor (and colour) when focus is lost (the 960Fades the image by the given factor (and colour) when focus is lost (the
961same as the C<-fade>/C<-fadecolo> command line options, which also supply 961same as the C<-fade>/C<-fadecolor> command line options, which also supply
962the default values for C<factor> and C<$color>. Unlike with C<-fade>, the 962the default values for C<factor> and C<$color>. Unlike with C<-fade>, the
963C<$factor> is the real value, not a percentage value (that is, 0..1, not 963C<$factor> is a real value, not a percentage value (that is, 0..1, not
9640..100). 9640..100).
965 965
966Example: do the right thing when focus fading is requested. 966Example: do the right thing when focus fading is requested.
967 967
968 focus_fade load "mybg.jpg"; 968 focus_fade load "mybg.jpg";
1186# } 1186# }
1187 1187
1188 # set background pixmap 1188 # set background pixmap
1189 1189
1190 $self->set_background ($img, $self->{border}); 1190 $self->set_background ($img, $self->{border});
1191 $self->scr_recolour (0); 1191 $self->scr_recolor (0);
1192 $self->want_refresh; 1192 $self->want_refresh;
1193} 1193}
1194 1194
1195sub on_start { 1195sub on_start {
1196 my ($self) = @_; 1196 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines