I've set up .Xresources
to be able to print the terminal contents to a file when pressing Alt-P:
XTerm*printAttributes: 2
XTerm*printerCommand: cat - > "`mktemp --tmpdir xterm-screenshot.bin.XXXXXXXXXX`"
XTerm.VT100.translations: #override Meta <KeyPress> P: print() \n
This seems to work fine, except that each line in the output is prefixed by some escape characters and the literal #5
. Compare the output at the start of the xterm
session:
user^2@host:~
$
Is that ESC#5ESC[0m
bit at the start normal?
less /tmp/xterm-screenshot.bin.*
:
ESC#5ESC[0muserESC[0;1;33m^2ESC[0m@host:ESC[0;1;34m~ESC[0m
ESC#5ESC[0m$ ESC[0m
less -R /tmp/xterm-screenshot.bin.*
:
[0muser^2@host:~
[0m$
Additional info:
$ xterm -version
XTerm(271)
$ uname -a
Linux user 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:46:35 UTC 2012 i686 i686 i386 GNU/Linux
less -R
rather thanless -r
. – l0b0 Oct 02 '12 at 07:09