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

21 lines
410 B
Plaintext
Raw Normal View History

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-$$"
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