imgcat script not working in screen
Pier Giuseppe Fogli <[email protected]> Fri, 1 Sep 2023 08:24:22 +0200
| Newsgroups | gmane.comp.gnu.screen.user |
|---|---|
| Message-ID | <CAE8wOt_cgMGM4uKGuw46=miL0nm7B+XyRbLfqB5Xp=r_nF=BSw@mail.gmail.com> |
--000000000000c09fd80604463624
Content-Type: text/plain; charset="UTF-8"
Hi,
I'd like to be able to use the imgcat shell script from inside GNU screen
in order to display images from remote hosts.
imgcat (https://iterm2.com/utilities/imgcat) is part of a collection of
shell scripts that make use of iTerm2 image display capabilities,
here the related documentation:
https://iterm2.com/documentation-images.html
It works outside GNU screen. From inside it generate a stream of
base 64 encoded text on the terminal.
I guess the problem here is to escape this stream from GNU screen
interpretation in some way, and let it be interpreted by the terminal
emulator.
According to the imgcat script it should be handled by this function:
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC
ESC. It
# only accepts ESC backslash for ST. We use TERM instead of TMUX because
TERM
# gets passed through ssh.
function print_osc() {
if [[ $TERM == screen* || $TERM == tmux* ]]; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"
fi
}
but it doesn't and I can't figure out how to fix it.
Any idea?
Thanks in advance,
PGF
--000000000000c09fd80604463624
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<br>I'd like to be able to use the imgcat shell scr=
ipt from inside GNU screen<br>in order to display images from remote hosts.=
<br>imgcat (<a href=3D"https://iterm2.com/utilities/imgcat">https://iterm2.=
com/utilities/imgcat</a>) is part of a collection of<br>shell scripts that =
make use of iTerm2 image display capabilities,<br>here the related document=
ation:<br><a href=3D"https://iterm2.com/documentation-images.html">https://=
iterm2.com/documentation-images.html</a><br><br>It works outside GNU screen=
. From inside it generate a stream of<br>base 64 encoded text on the termin=
al.<br>I guess the problem here is to escape this stream from GNU screen<br=
>interpretation in some way, and let it be interpreted by the terminal emul=
ator. <br>According to the imgcat script it should be handled by this funct=
ion:<br><br># tmux requires unrecognized OSC sequences to be wrapped with D=
CS tmux;<br># <sequence> ST, and for all ESCs in <sequence> to =
be replaced with ESC ESC. It<br># only accepts ESC backslash for ST. We use=
TERM instead of TMUX because TERM<br># gets passed through ssh.<br>functio=
n print_osc() {<br>=C2=A0 =C2=A0 if [[ $TERM =3D=3D screen* || $TERM =3D=3D=
tmux* ]]; then<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 printf "\033Ptmux;\033\=
033]"<br>=C2=A0 =C2=A0 else<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 printf &quo=
t;\033]"<br>=C2=A0 =C2=A0 fi<br>}<br><br>but it doesn't and I can&=
#39;t figure out how to fix it.<div>Any idea?<br><br>Thanks in advance,<br>=
PGF</div></div>
--000000000000c09fd80604463624--