screen-users
[Top][All Lists]
Advanced

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

Re: imgcat script not working in screen


From: Neal Fultz
Subject: Re: imgcat script not working in screen
Date: Fri, 1 Sep 2023 11:53:45 -0700

I use similar scripts from google's hterm project; to the extent that hterm is "iterm2 compatible" maybe they will work for you. I adapted them to support screen for the terminal graphics device in R. IIRC the scripts have a tweak to work with screen's buffer size for escaped data.

https://chromium.googlesource.com/apps/libapps/+/master/hterm/etc/

On Thu, Aug 31, 2023 at 11:25 PM Pier Giuseppe Fogli <piergiuseppe.fogli@cmcc.it> wrote:
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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]