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