Change font size in xterm using keyboard

| No Comments | No TrackBacks

I'm big fan of xterm with bitmap fonts (usually fixed, Terminus or Neep) for my terminals, mostly because it's small and quick (compare find . in your home directory full of files in some terminal with TrueType fonts and xterm with bitmap fonts to see difference).

But, I really wanted to have alternative way to change font size (other than Ctrl+right-click). I already wrote about xtermcontrol, but in my short usage of Gnome Terminal I noticed that having keyboard shortcuts for changing font size is really handy. And as always, xterm has solution for it. Put something like this in your ~/.Xdefaults:

XTerm.VT100.translations: #override \
Meta <Key> minus: smaller-vt-font() \n\
Meta <Key> plus: larger-vt-font() \n\
Meta <Key> KP_Subtract: smaller-vt-font() \n\
Meta <Key> KP_Add: larger-vt-font() \n\
Super <Key> minus: smaller-vt-font() \n\
Super <Key> plus: larger-vt-font() \n\
Super <Key> KP_Subtract: smaller-vt-font() \n\
Super <Key> KP_Add: larger-vt-font() \n
I decided to bind Meta (usually Alt) or Super (usually Windows key) and + or - on main keyboard or numeric keypad for quick and fail-safe access to terminal font size. As always with X server resource database whitespace is very important. Notice space after #override in first line.

You can invoke this configuration with something like xrdb -merge ~/.Xdefaults which you can put in your .xinitrc. You can make various other adjustments (see man xterm for all details), but usually you just want to change default font and reverse video (to get white on black terminal) using something like:

XTerm.VT100.font: -*-terminus-medium-r-normal-*-16-*-*-*-*-*-iso10646-*
XTerm.VT100.reverseVideo: true

No TrackBacks

TrackBack URL: http://blog.rot13.org/mt/mt-tb.cgi/684

Leave a comment

About this Entry

This page contains a single entry by Dobrica Pavlinušić published on March 2, 2010 1:43 PM.

Second day without S10-2: two day old laptop gone for repair was the previous entry in this blog.

Perl TR-069 ACS server to manage CPE devices is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

  • pics
OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.04