#!/bin/sh
set -e

previewdir="$HOME/.ncmpcpp/cover"

if [ ! -e "$previewdir/FIFO_UEBERZUG" ]; then
    mkfifo "$previewdir/FIFO_UEBERZUG"
fi

if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
	exit
else
	ueberzug layer -s <$previewdir/FIFO_UEBERZUG -p json &
	exec 3>$previewdir/FIFO_UEBERZUG
    read anything
fi
