NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Capture text in console with colors



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I ran into issue with a need to capture the screen of a running
program and paste it to libreoffice or similar tool as a listing with
colors.

While it's easier for batch programs putting output on stdout and
exiting, it was more difficult to do with ones with a curses-like
interface.

The solution is as follows:
1. Install textproc/aha for ANSI -> HTML converter
2. Set "set -g history-limit 0" in ~/.tmux.conf to disable scrollback
history
3. Start tmux(1) and go into the screen to be captured
4. Type other terminal session: tmux capture-pane -Jpe | aha > dump.html
5. Open dump.html from favorite browser (Firefox verified) and
copy-paste it to a libreoffice document.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWlZLsAAoJEEuzCOmwLnZsQJEP/RkK4L3jpvQk2pOjQLlVHLpS
hO5K4hi4MwU47faOoq0PrzJq4LkV79W6Pe1ZQ2BxHvrRgrJGjs02//w6hFNVxi1w
B4ad7FhYm5m++yAHhz08K0MMGtdvLqBCPrr11f0b9n4ybHWnyL7BU23TfIZQma7o
HhrJtj9A34jDU39/PGgGKBlDkrfQcE/TtFdp3BAlS9CSnAAh3GQXiyKiRJ/ntufE
MpdBCHSpNX5WgGRsVLGqTi09eOdX00TtEbwdyqSdNWGsC355H/PvZwxD8e/u7OEw
Rs+4ut2Wcb11MdpRxraBUx6iwtlSYZO9Pcc2tslWVUZgS03TSi7mk1I4gaVh3ao8
yN56UrRJej0gyjDY8B/zvsDXQKL7gX2Yq3ZmoGm8ypHIppqICjcKtFuXkKH5kjmR
3mcznfWAtEIteD7HF/1081gPErIB3QV12vHcWp9dg5FSdUWwBX/d5WA1yfF7nGdT
xEMw2+Yn/p/HhFbmJ3Tu9Cj3ahyXjbJudwsumWgTwJ6E1i9zMzSqw4SQdKIp2xGv
6oL8JHQH5FFwv3L2w3RGzEvwbmTg4894zufJhUS6kAoTpfSK/RcN9kEdGaJX0aQ9
7+PTMorLil8yZuteTI+bqRMUvc7dLmd4brHlf1wKPeM6sth7EarIn14BqRaIInbD
e6mvQ2MpL1CpQksMduj4
=wkR7
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index