Add script to start lf with ueberzug

This commit is contained in:
ItsDrike 2021-07-27 01:43:04 +02:00
parent 0acd5ecc77
commit 1a35c2fba6
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

24
home/.local/bin/scripts/lfu Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ -n "$DISPLAY" ]; then
export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"
cleanup() {
exec 3>&-
rm "$FIFO_UEBERZUG"
}
mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s <"$FIFO_UEBERZUG" &
exec 3>"$FIFO_UEBERZUG"
trap cleanup EXIT
if ! [ -d "$HOME/.cache/lf" ]; then
mkdir -p "$HOME/.cache/lf"
fi
lf "$@" 3>&-
else
exec lf "$@"
fi