vifmrun 441 B

123456789101112131415161718
  1. #!/bin/sh
  2. test -z "$(which ueberzug )" &&
  3. exec vifm "$@" && exit
  4. test -z "$DISPLAY" &&
  5. exec vifm "$@" && exit
  6. cleanup() {
  7. rm "$FIFO_UEBERZUG"
  8. pkill -P $$ >/dev/null
  9. }
  10. ! test -d "$HOME/.cache/vifm" && mkdir -p "$HOME/.cache/vifm"
  11. export FIFO_UEBERZUG="$HOME/.cache/vifm/ueberzug-${PPID}"
  12. mkfifo "$FIFO_UEBERZUG"
  13. tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash >/dev/null 2>&1 &
  14. trap cleanup EXIT
  15. vifm "$@"