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.
19 lines
505 B
19 lines
505 B
2 years ago
|
#!/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
|