Dynamically change the font size under rxvt-unicode (urxvt)

Terminal-icon

Like many, I have had my fair share of terminal emulators, from the good ol’ days of Konsole, xterm, gnome-terminal, Terminator and Eterm to name a few until I finally settle down with rxvt more specifically with rxvt-unicode.

There are many things that urxvt does well, but dynamically handling the size of a font is not one of them, it was not conceived in that way or oriented towards a desktop environment (DE) in particular. But it’s meant to run almost everywhere.

But, there is always hope!

And in this case you can add support for dynamically changing the font following some easy steps.

Go grab the required perl extension1.

https://github.com/majutsushi/urxvt-font-size

Install the extension (or create a link) in the directory:

$HOME/.urxvt/ext

Add the script instruction to the file you use to keep your urxvt configuration either .Xresources or .Xdefaults so it will be loaded on the next session.

URxvt.perl-ext-common:  ...,font-size

And after loading the script add the following lines to control the
behavior, this keybindings work under urxvt version 9.14 and onwards:

URxvt.keysym.C-Up:     perl:font-size:increase
URxvt.keysym.C-Down:   perl:font-size:decrease
URxvt.keysym.C-S-Up:   perl:font-size:incglobal
URxvt.keysym.C-S-Down: perl:font-size:decglobal

The keybindings basically work like this, pressing the control key plus the up or down key will increase/decrease the font size for the actual terminal, pressing the same keys plus shift key will increase/decrease the font size of all the terminals open (once all the urxvt sessions have loaded the new configuration) and this is it!

Now, urxvt is a little bit more wise and useful.


  1. Thank you majutsushi for this perl extension. 

Leave a Reply

Your email address will not be published. Required fields are marked *