background (rxvt-unicode-9.26.tar.bz2) | : | background (rxvt-unicode-9.29.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#:META:RESOURCE:pixmap:file[;geom]:set image as background | #:META:RESOURCE:pixmap:file[;geom]:set image as background | |||
#:META:RESOURCE:backgroundPixmap:file[;geom]:set image as background | #:META:RESOURCE:backgroundPixmap:file[;geom]:set image as background | |||
#:META:RESOURCE:tr:boolean:set root pixmap as background | #:META:RESOURCE:tr:boolean:set root pixmap as background | |||
#:META:RESOURCE:transparent:boolean:set root pixmap as background | #:META:RESOURCE:transparent:boolean:set root pixmap as background | |||
#:META:RESOURCE:tint:color:tint background with color | #:META:RESOURCE:tint:color:tint background with color | |||
#:META:RESOURCE:tintColor:color:tint background with color | #:META:RESOURCE:tintColor:color:tint background with color | |||
#:META:RESOURCE:sh:number:shade background by number % | #:META:RESOURCE:sh:number:shade background by number % | |||
#:META:RESOURCE:shading:number:shade background by number % | #:META:RESOURCE:shading:number:shade background by number % | |||
#:META:RESOURCE:blr:HxV:gaussian-blur background with radii | #:META:RESOURCE:blr:HxV:gaussian-blur background with radii | |||
#:META:RESOURCE:blurRadius:HxV:gaussian-blur background with radii | #:META:RESOURCE:blurRadius:HxV:gaussian-blur background with radii | |||
#:META:OSC:20:change/query background image | ||||
#:META:OSC:705:change transparent background tint colour | ||||
=head1 NAME | =head1 NAME | |||
background - manage terminal background | background - manage terminal background | |||
=head1 SYNOPSIS | =head1 SYNOPSIS | |||
urxvt --background-expr 'background expression' | urxvt --background-expr 'background expression' | |||
--background-border | --background-border | |||
--background-interval seconds | --background-interval seconds | |||
skipping to change at line 264 | skipping to change at line 266 | |||
keep { load "$HOME/path..." } | keep { load "$HOME/path..." } | |||
Not only caches the image in memory, other terminal instances that try to | Not only caches the image in memory, other terminal instances that try to | |||
C<load> it can reuse that in-memory copy. | C<load> it can reuse that in-memory copy. | |||
=head1 REFERENCE | =head1 REFERENCE | |||
=head2 COMMAND LINE SWITCHES | =head2 COMMAND LINE SWITCHES | |||
=over 4 | =over | |||
=item --background-expr perl-expression | =item --background-expr perl-expression | |||
Specifies the Perl expression to evaluate. | Specifies the Perl expression to evaluate. | |||
=item --background-border | =item --background-border | |||
By default, the expression creates an image that fills the full window, | By default, the expression creates an image that fills the full window, | |||
overwriting borders and any other areas, such as the scrollbar. | overwriting borders and any other areas, such as the scrollbar. | |||
skipping to change at line 315 | skipping to change at line 317 | |||
sub FR_STATE () { 3 } # watchers etc. | sub FR_STATE () { 3 } # watchers etc. | |||
use List::Util qw(min max sum shuffle); | use List::Util qw(min max sum shuffle); | |||
=head2 PROVIDERS/GENERATORS | =head2 PROVIDERS/GENERATORS | |||
These functions provide an image, by loading it from disk, grabbing it | These functions provide an image, by loading it from disk, grabbing it | |||
from the root screen or by simply generating it. They are used as starting | from the root screen or by simply generating it. They are used as starting | |||
points to get an image you can play with. | points to get an image you can play with. | |||
=over 4 | =over | |||
=item load $path | =item load $path | |||
Loads the image at the given C<$path>. The image is set to plane tiling | Loads the image at the given C<$path>. The image is set to plane tiling | |||
mode. | mode. | |||
If the image is already in memory (e.g. because another terminal instance | If the image is already in memory (e.g. because another terminal instance | |||
uses it), then the in-memory copy is returned instead. | uses it), then the in-memory copy is returned instead. | |||
=item load_uc $path | =item load_uc $path | |||
skipping to change at line 444 | skipping to change at line 446 | |||
$base | $base | |||
} | } | |||
=back | =back | |||
=head2 TILING MODES | =head2 TILING MODES | |||
The following operators modify the tiling mode of an image, that is, the | The following operators modify the tiling mode of an image, that is, the | |||
way that pixels outside the image area are painted when the image is used. | way that pixels outside the image area are painted when the image is used. | |||
=over 4 | =over | |||
=item tile $img | =item tile $img | |||
Tiles the whole plane with the image and returns this new image - or in | Tiles the whole plane with the image and returns this new image - or in | |||
other words, it returns a copy of the image in plane tiling mode. | other words, it returns a copy of the image in plane tiling mode. | |||
Example: load an image and tile it over the background, without | Example: load an image and tile it over the background, without | |||
resizing. The C<tile> call is superfluous because C<load> already defaults | resizing. The C<tile> call is superfluous because C<load> already defaults | |||
to tiling mode. | to tiling mode. | |||
skipping to change at line 529 | skipping to change at line 531 | |||
=back | =back | |||
=head2 VARIABLE VALUES | =head2 VARIABLE VALUES | |||
The following functions provide variable data such as the terminal window | The following functions provide variable data such as the terminal window | |||
dimensions. They are not (Perl-) variables, they just return stuff that | dimensions. They are not (Perl-) variables, they just return stuff that | |||
varies. Most of them make your expression sensitive to some events, for | varies. Most of them make your expression sensitive to some events, for | |||
example using C<TW> (terminal width) means your expression is evaluated | example using C<TW> (terminal width) means your expression is evaluated | |||
again when the terminal is resized. | again when the terminal is resized. | |||
=over 4 | =over | |||
=item TX | =item TX | |||
=item TY | =item TY | |||
Return the X and Y coordinates of the terminal window (the terminal | Return the X and Y coordinates of the terminal window (the terminal | |||
window is the full window by default, and the character area only when in | window is the full window by default, and the character area only when in | |||
border-respect mode). | border-respect mode). | |||
Using these functions makes your expression sensitive to window moves. | Using these functions makes your expression sensitive to window moves. | |||
skipping to change at line 632 | skipping to change at line 634 | |||
$frame->[FR_AGAIN]{time} = $_[0]; | $frame->[FR_AGAIN]{time} = $_[0]; | |||
$frame->[FR_STATE]{counter} + 0 | $frame->[FR_STATE]{counter} + 0 | |||
} | } | |||
=back | =back | |||
=head2 SHAPE CHANGING OPERATORS | =head2 SHAPE CHANGING OPERATORS | |||
The following operators modify the shape, size or position of the image. | The following operators modify the shape, size or position of the image. | |||
=over 4 | =over | |||
=item clip $img | =item clip $img | |||
=item clip $width, $height, $img | =item clip $width, $height, $img | |||
=item clip $x, $y, $width, $height, $img | =item clip $x, $y, $width, $height, $img | |||
Clips an image to the given rectangle. If the rectangle is outside the | Clips an image to the given rectangle. If the rectangle is outside the | |||
image area (e.g. when C<$x> or C<$y> are negative) or the rectangle is | image area (e.g. when C<$x> or C<$y> are negative) or the rectangle is | |||
larger than the image, then the tiling mode defines how the extra pixels | larger than the image, then the tiling mode defines how the extra pixels | |||
skipping to change at line 829 | skipping to change at line 831 | |||
$_[2] * (3.14159265 / 180), | $_[2] * (3.14159265 / 180), | |||
) | ) | |||
} | } | |||
=back | =back | |||
=head2 COLOUR MODIFICATIONS | =head2 COLOUR MODIFICATIONS | |||
The following operators change the pixels of the image. | The following operators change the pixels of the image. | |||
=over 4 | =over | |||
=item tint $color, $img | =item tint $color, $img | |||
Tints the image in the given colour. | Tints the image in the given colour. | |||
Example: tint the image red. | Example: tint the image red. | |||
tint "red", load "rgb.png" | tint "red", load "rgb.png" | |||
Example: the same, but specify the colour by component. | Example: the same, but specify the colour by component. | |||
skipping to change at line 1004 | skipping to change at line 1006 | |||
$img | $img | |||
} | } | |||
=back | =back | |||
=head2 OTHER STUFF | =head2 OTHER STUFF | |||
Anything that didn't fit any of the other categories, even after applying | Anything that didn't fit any of the other categories, even after applying | |||
force and closing our eyes. | force and closing our eyes. | |||
=over 4 | =over | |||
=item keep { ... } | =item keep { ... } | |||
This operator takes a code block as argument, that is, one or more | This operator takes a code block as argument, that is, one or more | |||
statements enclosed by braces. | statements enclosed by braces. | |||
The trick is that this code block is only evaluated when the outcome | The trick is that this code block is only evaluated when the outcome | |||
changes - on other calls the C<keep> simply returns the image it computed | changes - on other calls the C<keep> simply returns the image it computed | |||
previously (yes, it should only be used with images). Or in other words, | previously (yes, it should only be used with images). Or in other words, | |||
C<keep> I<caches> the result of the code block so it doesn't need to be | C<keep> I<caches> the result of the code block so it doesn't need to be | |||
skipping to change at line 1047 | skipping to change at line 1049 | |||
=back | =back | |||
=head1 OLD BACKGROUND IMAGE SETTINGS | =head1 OLD BACKGROUND IMAGE SETTINGS | |||
This extension also provides support for the old options/resources and | This extension also provides support for the old options/resources and | |||
OSC sequences for setting a background image. These settings are | OSC sequences for setting a background image. These settings are | |||
B<deprecated> and will be removed in future versions. | B<deprecated> and will be removed in future versions. | |||
=head2 OPTIONS AND RESOURCES | =head2 OPTIONS AND RESOURCES | |||
=over 4 | =over | |||
=item B<-pixmap> I<file[;oplist]> | =item B<-pixmap> I<file[;oplist]> | |||
=item B<backgroundPixmap:> I<file[;oplist]> | =item B<backgroundPixmap:> I<file[;oplist]> | |||
Use the specified image file as the window's background and also | Use the specified image file as the window's background and also | |||
optionally specify a colon separated list of operations to modify it. | optionally specify a colon separated list of operations to modify it. | |||
Note that you may need to quote the C<;> character when using the | Note that you may need to quote the C<;> character when using the | |||
command line option, as C<;> is usually a metacharacter in shells. | command line option, as C<;> is usually a metacharacter in shells. | |||
Supported operations are: | Supported operations are: | |||
=over 4 | =over | |||
=item B<WxH+X+Y> | =item B<WxH+X+Y> | |||
sets scale and position. B<"W" / "H"> specify the horizontal/vertical | sets scale and position. B<"W" / "H"> specify the horizontal/vertical | |||
scale (percent), and B<"X" / "Y"> locate the image centre (percent). A | scale (percent), and B<"X" / "Y"> locate the image centre (percent). A | |||
scale of 0 disables scaling. | scale of 0 disables scaling. | |||
=item B<op=tile> | =item B<op=tile> | |||
enables tiling | enables tiling | |||
skipping to change at line 1086 | skipping to change at line 1088 | |||
use the position of the terminal window relative to the root window as | use the position of the terminal window relative to the root window as | |||
the image offset, simulating a root window background | the image offset, simulating a root window background | |||
=back | =back | |||
The default scale and position setting is C<100x100+50+50>. | The default scale and position setting is C<100x100+50+50>. | |||
Alternatively, a predefined set of templates can be used to achieve | Alternatively, a predefined set of templates can be used to achieve | |||
the most common setups: | the most common setups: | |||
=over 4 | =over | |||
=item B<style=tiled> | =item B<style=tiled> | |||
the image is tiled with no scaling. Equivalent to 0x0+0+0:op=tile | the image is tiled with no scaling. Equivalent to 0x0+0+0:op=tile | |||
=item B<style=aspect-stretched> | =item B<style=aspect-stretched> | |||
the image is scaled to fill the whole window maintaining the aspect | the image is scaled to fill the whole window maintaining the aspect | |||
ratio and centered. Equivalent to 100x100+50+50:op=keep-aspect | ratio and centered. Equivalent to 100x100+50+50:op=keep-aspect | |||
skipping to change at line 1161 | skipping to change at line 1163 | |||
=head2 OSC sequences | =head2 OSC sequences | |||
This extension will react to the following OSC sequences. Note that | This extension will react to the following OSC sequences. Note that | |||
this extension will not be autoloaded when these are used currently, | this extension will not be autoloaded when these are used currently, | |||
so to make urxvt recognize them, you have to enable the C<background> | so to make urxvt recognize them, you have to enable the C<background> | |||
extension. One way to achieve that is to use the C<--background-expr ''> | extension. One way to achieve that is to use the C<--background-expr ''> | |||
command line argument or by specifying an empty C<URxvt.background.expr:>> | command line argument or by specifying an empty C<URxvt.background.expr:>> | |||
resource. | resource. | |||
=over 4 | =over | |||
=item B<< C<ESC ] 705 ; Pt ST> >> Change transparent background tint colour to B << C<Pt> >>. | =item B<< C<ESC ] 705 ; Pt ST> >> Change transparent background tint colour to B << C<Pt> >>. | |||
=item B<< C<ESC ] 20 ; Pt ST> >> Change/Query background image | =item B<< C<ESC ] 20 ; Pt ST> >> Change/Query background image | |||
parameters: the value of B<< C<Pt> >> can be one of the following | parameters: the value of B<< C<Pt> >> can be one of the following | |||
commands: | commands: | |||
=over 4 | =over | |||
=item B<< C<?> >> | =item B<< C<?> >> | |||
display scale and position in the title | display scale and position in the title | |||
=item B<< C<;WxH+X+Y> >> | =item B<< C<;WxH+X+Y> >> | |||
change scale and/or position | change scale and/or position | |||
=item B<< C<FILE;WxH+X+Y> >> | =item B<< C<FILE;WxH+X+Y> >> | |||
skipping to change at line 1325 | skipping to change at line 1327 | |||
if ($arg_self->{next_refresh} > urxvt::NOW) { | if ($arg_self->{next_refresh} > urxvt::NOW) { | |||
$arg_self->{next_refresh_timer} = urxvt::timer->new->after ($arg_self->{ne xt_refresh} - urxvt::NOW)->cb (sub { | $arg_self->{next_refresh_timer} = urxvt::timer->new->after ($arg_self->{ne xt_refresh} - urxvt::NOW)->cb (sub { | |||
$arg_self->recalculate; | $arg_self->recalculate; | |||
}); | }); | |||
return; | return; | |||
} | } | |||
$arg_self->{next_refresh} = urxvt::NOW + $MIN_INTERVAL; | $arg_self->{next_refresh} = urxvt::NOW + $MIN_INTERVAL; | |||
unless ($arg_self->has_render) { | unless ($arg_self->has_render) { | |||
warn "background extension needs RENDER extension 0.10 or higher, ignoring background-expr.\n"; | warn "background extension needs RENDER extension 0.11 or higher, ignoring background-expr.\n"; | |||
return; | return; | |||
} | } | |||
# set environment to evaluate user expression | # set environment to evaluate user expression | |||
local $self = $arg_self; | local $self = $arg_self; | |||
local $HOME = $ENV{HOME}; | local $HOME = $ENV{HOME}; | |||
local $frame = $self->{root}; | local $frame = $self->{root}; | |||
($x, $y, $w, $h) = $self->background_geometry ($self->{border}); | ($x, $y, $w, $h) = $self->background_geometry ($self->{border}); | |||
skipping to change at line 1350 | skipping to change at line 1352 | |||
my @img = eval { $self->{expr}->() }; | my @img = eval { $self->{expr}->() }; | |||
die $@ if $@; | die $@ if $@; | |||
die "background-expr did not return anything.\n" unless @img; | die "background-expr did not return anything.\n" unless @img; | |||
if ($img[0]) { | if ($img[0]) { | |||
die "background-expr: expected image(s), got something else.\n" | die "background-expr: expected image(s), got something else.\n" | |||
if grep { !UNIVERSAL::isa $_, "urxvt::img" } @img; | if grep { !UNIVERSAL::isa $_, "urxvt::img" } @img; | |||
my $img = urxvt::bgdsl::merge @img; | my $img = urxvt::bgdsl::merge @img; | |||
$frame->[FR_AGAIN]{size} = 1 | $frame->[urxvt::bgdsl::FR_AGAIN]{size} = 1 | |||
if $img->repeat_mode != urxvt::RepeatNormal; | if $img->repeat_mode != urxvt::RepeatNormal; | |||
# if the expression is sensitive to external events, prepare reevaluation then | # if the expression is sensitive to external events, prepare reevaluation then | |||
$self->compile_frame ($frame, sub { $arg_self->recalculate }); | $self->compile_frame ($frame, sub { $arg_self->recalculate }); | |||
# clear stuff we no longer need | # clear stuff we no longer need | |||
# unless (%{ $frame->[FR_STATE] }) { | # unless (%{ $frame->[FR_STATE] }) { | |||
# delete $self->{state}; | # delete $self->{state}; | |||
# delete $self->{expr}; | # delete $self->{expr}; | |||
End of changes. 15 change blocks. | ||||
14 lines changed or deleted | 16 lines changed or added |