« Second day without S10-2: two day old laptop gone for repair | Main | Perl TR-069 ACS server to manage CPE devices »

Change font size in xterm using keyboard

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

TrackBack

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

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on March 2, 2010 1:43 PM.

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

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

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 5.04