This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / nnn / imgpreview.sh
959 B 28 lines
1#!/usr/bin/env bash 2# Render an image for nnn's preview pane. 3# 4# preview-tui kills the previewer the instant the selection changes. Being 5# killed halfway through a kitty/sixel escape sequence leaves the terminal (and 6# tmux, when passthrough is in play) waiting for a terminator and swallowing 7# everything that follows, so the pane just goes blank and stays blank. Decode 8# into memory first, where a kill costs nothing, then write the finished frame 9# out in one go with the signals blocked. 10 11size=$(stty size </dev/tty 2>/dev/null) || size="24 80" 12rows=${size%% *} 13cols=${size##* } 14 15# The format is decided once per nnn session by term-caps; probing here would 16# put a terminal round trip inside the very window we are trying to protect. 17frame=$( 18 chafa \ 19 --probe off \ 20 --format "${NNN_IMGFORMAT:-symbols}" \ 21 --passthrough auto \ 22 --animate off \ 23 --size "${cols}x$((rows - 1))" \ 24 -- "$1" 25) || exit 0 26 27trap '' HUP INT TERM 28printf '%s' "$frame"