diff options
| author | Mike Vink <mike@pionative.com> | 2024-04-19 17:39:16 +0200 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-04-19 17:39:16 +0200 |
| commit | e39341f567c74f88a3610adce25d42e2a3666a91 (patch) | |
| tree | f12f8cf89eea186c2a005613ff07832169da22da /mut/bin/lfub | |
| parent | 985cac44e0c7b33763d0f9d26842ad5325a4a303 (diff) | |
update from lemptop
Diffstat (limited to 'mut/bin/lfub')
| -rwxr-xr-x | mut/bin/lfub | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mut/bin/lfub b/mut/bin/lfub index 894ffde..ffcb52a 100755 --- a/mut/bin/lfub +++ b/mut/bin/lfub @@ -3,7 +3,6 @@ # This is a wrapper script for lb that allows it to create image previews with # ueberzug. This works in concert with the lf configuration file and the # lf-cleaner script. - set -e cleanup() { @@ -11,4 +10,14 @@ cleanup() { rm "$FIFO_UEBERZUG" } -lf "$@" +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi |
