Bob Hepple wrote: > BTW - The added bonus with mrxvt is that Shift-KP_ADD and > Shift-KP_Subtract allow the font to be tweaked up and down in size -
Attached is a Perl script to add the same functionality to urxvt. The fonts are hard-coded in the script, and it probably isn't the best Perl as I don't normally use Perl. But here it is for what it's worth. -- John Eikenberry [[email protected] - http://zhar.net] [PGP public key @ http://zhar.net/jae_at_zhar_net.gpg] ______________________________________________________________ "Perfection is attained, not when no more can be added, but when no more can be removed." -- Antoine de Saint-Exupery
# Cycle through set of font sizes # by John Eikenberry <[email protected]> # # called via keysym hook in .Xresources # E.g., To use Ctrl-Meta-[plus]/Ctrl-Meta-[minus] use... # URxvt*keysym.C-M-equal: command:\033]777;font-size:+\007 # URxvt*keysym.C-M-minus: command:\033]777;font-size:-\007 # # Be warned. I don't use perl normally. So this might not be optimal. use strict; use List::Util qw(first); # font and sizes that I can cycle to my $font_name = 'terminus'; my @font_sizes = qw(12 14 16 20 24 28 32); my @fonts = map{"$font_name-$_"} @font_sizes; # same as the URxvt*font line in my .XResources file my $font_default = 'terminus-16, -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'; # urxvt hook sub on_osc_seq_perl { # $self is terminal object reference # $str is string after escape sequence my ($self, $str) = @_; # current font size of terminal my $sz = $self->{term}->resource('font'); $sz =~ s/$font_name-(\d+).*/$1/; # loop through font sizes and set new size # should probably use a map instead, but this works my $max = (scalar @font_sizes) - 1; my $font = $font_default; foreach (0 .. $max) { if ($font_sizes[$_] == $sz) { if ($str =~ /font-size:\+/) { my $idx = $_ + 1; # stop at max size if ($idx >= $max) { return }; $font = $fonts[$idx]; last; } else { my $idx = $_ - 1; # stop at min size if ($idx < 0) { return }; $font = $fonts[$idx]; last; }; }; }; # set new font on terminal $self->{term}->cmd_parse("\033]50;$font\007"); }; ## vim: ft=perl
signature.asc
Description: Digital signature
_______________________________________________ rxvt-unicode mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
