3 # This is a modified version of the 'imgls' from iTerm2 located at
4 # https://iterm2.com/utilities/imgls, modified to emit images with the
5 # Jexer image protocol.
7 # tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
8 # <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
9 # only accepts ESC backslash for ST.
10 function print_osc
() {
11 if [ x
"$TERM" = "xscreen" ] ; then
12 printf "\033Ptmux;\033\033]"
18 function check_dependency
() {
19 if ! (builtin command -V "$1" > /dev
/null
2>& 1); then
20 echo "imgcat: missing dependency: can't find $1" 1>& 2
25 # More of the tmux workaround described above.
27 if [ x
"$TERM" = "xscreen" ] ; then
34 function list_file
() {
36 test -f "$fn" ||
return 0
38 if [ "${fn: -4}" == ".png" ]; then
43 elif [ "${fn: -4}" == ".jpg" ]; then
51 check_dependency base64