1
0
Fork 0
dotfiles/.local/bin/lfub

22 lines
451 B
Plaintext
Raw Normal View History

2023-06-13 16:09:53 +02:00
#!/bin/sh
set -e
clean () {
exec 3>&-
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"
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