urxvt or unicode-rxvt is a terminal simulator like Gnome-terminal or Konsole. Recently I’m trying to switch to use i3 (i3-gaps), a tiling windows manager, and urxvt is good compliment to i3.

Unlike Gnome-terminal or Konsole, the font name and size for urxvt are configured in ~/.Xresources. To make change to font size, for example, I’d edit ~/.Xresources, reload it with xrdb ~/.Xresources, and finally close and re-open urxvt itself. Though there is no built-in function to allow changing font size on the fly, urxvt allows us to do this via extensions.

This blog post explains how we can enable the font resize on the fly on Fedora 27.

First we need to find out the location where we can drop the extension to. This can be done by checking the manual of urxvt and look for perl-lib. On Fedora 27,

Next we need to find a urxvt extension that does the font resizing on the fly. I’m using urxvt-resize-font which can be downloaded from here. (There could be other extensions made by others but I only tried the on mentioned here.)

Clone the repo, and move urxvt-resize-font file to ~/.urxvt/ext/.

Then modify ~/.Xresources add resize-font to the urxvt.perl-ext-common setting so urxvt loads the extension, e.g:

Finally, for one last time, we need to reload .Xresources, and restart urxvt.

Here’s the default key binding to resize font on urxvt:

  • CTRL +: increase font size
  • CTRL -: decrease font size
  • CTRL =: reset font size

If you’re not happy with the default shortcuts, you can also specify a customized ones in ~/.Xresources as the following:

Remember to load the .Xresources with xrdb and restart urxvt for the change to take effect. You should now use CTRL+j and CTRL+k to decrease and increase the font size respectively.