Added ueberzugpp to lf
This commit is contained in:
parent
613c97cee8
commit
fc2e67675d
4 changed files with 50 additions and 40 deletions
32
.local/bin/lf
Executable file
32
.local/bin/lf
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
# Ueberzugpp script for lf file explorer
|
||||
|
||||
set -e
|
||||
|
||||
UB_PID=0
|
||||
UB_SOCKET=""
|
||||
|
||||
case "$(uname -a)" in
|
||||
*Darwin*) UEBERZUG_TMP_DIR="$TMPDIR" ;;
|
||||
*) UEBERZUG_TMP_DIR="/tmp" ;;
|
||||
esac
|
||||
|
||||
cleanup() {
|
||||
exec 3>&-
|
||||
ueberzugpp cmd -s "$UB_SOCKET" -a exit
|
||||
}
|
||||
|
||||
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||
/usr/bin/lf "$@"
|
||||
else
|
||||
[ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
|
||||
UB_PID_FILE="$UEBERZUG_TMP_DIR/.$(uuidgen)"
|
||||
ueberzugpp layer --silent --no-stdin --use-escape-codes --pid-file "$UB_PID_FILE"
|
||||
UB_PID=$(cat "$UB_PID_FILE")
|
||||
rm "$UB_PID_FILE"
|
||||
UB_SOCKET="$UEBERZUG_TMP_DIR/ueberzugpp-${UB_PID}.socket"
|
||||
export UB_PID UB_SOCKET
|
||||
trap cleanup HUP INT QUIT TERM EXIT
|
||||
/usr/bin/lf "$@" 3>&-
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue