From: Grant Taylor <gtaylor@tnetconsulting.net>
To: zsh-users@zsh.org
Subject: Re: Is there a way of getting current xterm buffer?
Date: Tue, 19 Sep 2023 22:05:41 -0500 [thread overview]
Message-ID: <667f3f2c-eb20-34b0-0e4e-8efe8b106ab1@tnetconsulting.net> (raw)
In-Reply-To: <CAKc7PVAWcQ7HokZAF0LzoLciY3_cDSp0wzTkP=25ov+waKYmig@mail.gmail.com>
On 9/19/23 5:21 PM, Sebastian Gniazdowski wrote:
> It fine to save the screen copy to a file, I can read it via $(<file).
Fair enough.
> Does xterm can save the screen to a file, via the "media-copy" control
> seq that you've mentioned?
XTerm can be configured to save content sent via media copy to a file.
N.B. media copy doesn't capture the screen to a file. Rather media copy
causes XTerm to take subsequent data and send it to the file.
You set media copy on, send data to -- ostensibly -- print to media, and
then set media copy off to return the terminal to normal operations.
> Is there some example available of how to use it?
I've got things somewhere.
Hand typing this between terminals for $REASONS.
--8<--
#!/bin/bash
# Media Copy On
echo -n "^[[5i"
cat -
# Media Copy Off
echo -n "^[[4i"
-->8--
^[ is a stand in for the escape character.
This is the standard Control Sequence Introducer (CSI). Escape followed
by an open square bracket.
I use this with something like the following:
% uname -a | mediacopy
That causes uname's STDOUT to go into the mediacopy script's STDIN which
gets wrapped with the CSI 5 i or CSI 4 i.
I have the following configured in my ~/.Xdefaults:
--8<--
XTerm.vt100.printerCommand: /path/to/XTerm.vt100.printerCommand.sh
-->8--
My XTerm.vt100.printerCommand.sh is fairly simple.
--8<--
#!/bin/bash
cat - > `date +/path/to/destination.d/XTerm-printout-%Y%m%d-%H%M%S.txt`
-->8--
Remember to use xrdb et al. to load the updated ~/.Xdefaults file. Or
otherwise get the XTerm.vt100.printerCommand setting into X11.
--
Grant. . . .
unix || die
next prev parent reply other threads:[~2023-09-20 3:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 7:48 Sebastian Gniazdowski
2023-09-13 9:16 ` Roman Perepelitsa
2023-09-13 14:35 ` A. Wik
2023-09-13 15:14 ` Grant Taylor
2023-09-13 15:18 ` Roman Perepelitsa
2023-09-13 16:01 ` Oliver Kiddle
2023-09-13 16:10 ` Roman Perepelitsa
2023-09-13 18:59 ` Grant Taylor
2023-09-19 22:21 ` Sebastian Gniazdowski
2023-09-20 3:05 ` Grant Taylor [this message]
2023-09-20 12:28 ` Sebastian Gniazdowski
2023-09-21 18:05 ` Grant Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=667f3f2c-eb20-34b0-0e4e-8efe8b106ab1@tnetconsulting.net \
--to=gtaylor@tnetconsulting.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).