It's possible to change the xterm font size by holding ctrl and right-clicking the window. Is it possible to do it without a mouse?
Asked
Active
Viewed 5,302 times
3
Toothrot
- 3,255
- 3
- 24
- 47
-
Related and possibly a duplicate: [How to make XTerm smaller-vt-font() and larger-vt-font() use smoother steps?](https://unix.stackexchange.com/questions/510829/how-to-make-xterm-smaller-vt-font-and-larger-vt-font-use-smoother-steps). See the ```XTerm.vt100.translations: #override \n\```. – Freddy Mar 21 '20 at 16:11
-
That's related, but not a duplicate. – Thomas Dickey Mar 21 '20 at 16:12
2 Answers
8
The default keybindings include what's needed:
Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\
Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\
Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\
That is (without any customization needed):
- shift
keypad +switches to the next-larger font. - shift
keypad -switches to the next-smaller font.
There are two bindings for KP_Add to make it workable by default on some unusual keyboards.
This was originally just for bitmap-fonts (in 1999); TrueType fonts were accommodated in 2008.
It is also possible to do this with an escape-sequence, e.g.,
printf '\033]50;#+1\007'
to switch to the next-larger font, and
printf '\033]50;#-1\007'
to switch to the next-smaller font. The fonts.sh script in the sources makes xterm repeatedly shrink/grow, and when interrupted, restores the original font. (The \007 in the printf is a nonprinting control/G in the script to accommodate very old shells).
Thomas Dickey
- 75,040
- 9
- 171
- 268
-
Thank you. Would you explain how to do it with an escape sequence as well? I couldn't tell from the linked page. – Toothrot Mar 21 '20 at 18:39