Increase font size in rxvt-unicode without editing ~/.Xdefaults

fontsrxvt

I am a loyal Linux fan who has been spending a lot of time using iTerm on a mac lately. One thing I really like about the mac, and iTerm in particular, is the ability to use a keyboard shortcut to in/decrease the font size. I believe it's apple+ and apple- to do this. AFAIK this is also possible using gnome-terminal and possibly konqueror.

However, I am an rxvt-unicode user. Period. I'm not willing to switch my terminal, but I would like to be able to have the ability to quickly resize the font. Currently, to resize the font I have to do this:

  1. Detach tmux
  2. $EDITOR ~/.Xdefaults
  3. xrdb -all ~/.Xdefaults
  4. close terminal
  5. open a new terminal
  6. Reattach tmux

I'm thinking that it must be possible to script something that would reduce the above steps to one by perhaps binding to a keyboard shortcut, maybe with xbindkeys or something similar. Anyone have any thoughts on how this might best be accomplished?

Note: I'm using awesome window manager and prefer to keep things ultra-simple (i.e., no Gnome/KDE-specific solutions, please).

@Keith: I am familiar with the escape sequences and it's my fault for not saying so explicitly in my original question, but: I'm looking for a solution that will persist between sessions. Likely that will involve writing some code.

Best Answer

From the man page:

CHANGING FONTS Changing fonts (or font sizes, respectively) via the keypad is not yet supported in rxvt-unicode. Bug me if you need this.

   You can, however, switch fonts at runtime using escape sequences,

e.g.:

      printf '\e]710;%s\007' "9x15bold,xft:Kochi Gothic"

   You can use keyboard shortcuts, too:

      URxvt.keysym.M-C-1: command:\033]710;suxuseuro\007\033]711;suxuseuro\007
      URxvt.keysym.M-C-2: command:\033]710;9x15bold\007\033]711;9x15bold\007

   rxvt-unicode will automatically re-apply these fonts to the output so

far.

Depending on the shell you use you could assign those to keyboard shortcuts. In zsh you could define a shell function and use bindkey to bind it to an alt-key for example.

Related Question