shit
This commit is contained in:
commit
01a9e86575
64 changed files with 2284 additions and 0 deletions
29
scripts/lfimg
Normal file
29
scripts/lfimg
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
set -euf
|
||||
|
||||
if [ -n "${DISPLAY-}" ] && [ -z "${FIFO_UEBERZUG-}" ]; then
|
||||
export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"
|
||||
|
||||
cleanup() {
|
||||
exec 3>&-
|
||||
rm -- "$FIFO_UEBERZUG"
|
||||
}
|
||||
|
||||
mkfifo -- "$FIFO_UEBERZUG"
|
||||
# Execute ueberzug in a loop in case it crashes. Ueberzug dies if its
|
||||
# associated window is closed. This breaks image previews when using tmux and
|
||||
# reattaching to an existing session.
|
||||
while ! ueberzug layer -s <"$FIFO_UEBERZUG"; do :; done &
|
||||
# Open the FIFO for writing. FIFO readers receive an EOF once all writers
|
||||
# have closed their respective file descriptors. Holding a file descriptor
|
||||
# will effectively keep ueberzug alive as long as lf lives.
|
||||
exec 3>"$FIFO_UEBERZUG"
|
||||
trap cleanup EXIT
|
||||
|
||||
# Start lf without passing in the file descriptor. This is done to avoid the
|
||||
# lf server being passed the file descriptor, which would cause ueberzug to
|
||||
# live longer than is strictly necessary.
|
||||
lf "$@" 3>&-
|
||||
else
|
||||
exec lf "$@"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue