You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
505 B

#!/usr/bin/env bash
if [ -z "$(whereis ueberzug | awk '{print $2}')" ]; then
exec vifm "$@" && exit
elif [ -z "$DISPLAY" ]; then
exec vifm "$@" && exit
else
cleanup() {
rm "$FIFO_UEBERZUG"
pkill -P $$ >/dev/null
}
[ ! -d "$HOME/.cache/vifm" ] && mkdir --parents "$HOME/.cache/vifm"
export FIFO_UEBERZUG="$HOME/.cache/vifm/ueberzug-${PPID}"
mkfifo "$FIFO_UEBERZUG"
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash 2>&1 >/dev/null &
trap cleanup EXIT
vifm "$@"
fi