2023-06-13 16:09:53 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
clean () {
|
|
|
|
exec 3>&-
|
2023-06-13 19:35:02 +02:00
|
|
|
rm "$FIFO_UEBERZUG"
|
2023-06-13 16:09:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
2023-06-13 19:13:27 +02:00
|
|
|
command lf "$@"
|
2023-06-13 16:09:53 +02:00
|
|
|
else
|
|
|
|
[ ! -d "$XDG_CACHE_HOME/lf" ] && mkdir --parents "$XDG_CACHE_HOME/lf"
|
2023-06-13 19:35:02 +02:00
|
|
|
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
|
|
|
|
mkfifo "$FIFO_UEBERZUG"
|
|
|
|
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
|
|
|
|
exec 3>"$FIFO_UEBERZUG"
|
2023-06-13 16:09:53 +02:00
|
|
|
trap clean HUP INT QUIT TERM PWR EXIT
|
2023-06-13 19:13:27 +02:00
|
|
|
command lf "$@" 3>&-
|
2023-06-13 16:09:53 +02:00
|
|
|
fi
|
|
|
|
|