Highlight cursor line when focus is lost.
[profile.git] / .urxvt / font
1 #!/usr/bin/perl
2
3 # Perl extension to resize the terminal.
4 sub on_user_command {
5   my ($self, $cmd) = @_;
6
7   # Get existing fontset, something like:
8   # xft:DejaVu Sans Mono:pixelsize=12:aspect=0.9,xft:AR PL Uming HK
9   my $fontset = $self->{term}->resource("font");
10   my @fonts = split /,/, $fontset;
11   my @new = ();
12
13   # Split into individual font definitions.
14   foreach my $font (@fonts) {
15     if ($font =~ /:pixelsize=(\d+)/) {
16       my $size = $1;
17       my $adjusted = $size;
18
19       # Rewrite the font definition to be resized.
20       if ($cmd =~ /:bigger/) { $adjusted++ }
21       elsif ($cmd =~ /:smaller/) { $adjusted-- }
22
23       $adjusted = 1 if $adjusted < 1;
24       $font =~ s/:pixelsize=$size/:pixelsize=$adjusted/;
25     }
26
27     push @new, $font;
28   }
29
30   # Set the new fontset.  Just putting the resource doesn't work so
31   # use an escape sequence.
32   $fontset = join(",", @new);
33   $self->{term}->cmd_parse("\033]50;$fontset\007");
34 }