aboutsummaryrefslogtreecommitdiffstats
path: root/.config/cmus/cover-art/display.sh
blob: 739ff07caed9237922046c93cdffffc61eab838e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

CURRENT_DIR=`dirname "$BASH_SOURCE"`
COVERS_DIR="$CURRENT_DIR/.cover"

PREVIOUS=""
CURRENT=""

IMAGE_VIEWER="$CURRENT_DIR/imagemagick"

clear
while (true)
do
    CURRENT=$(ls ${COVERS_DIR})
    if [ "$CURRENT" != "$PREVIOUS" ]
    then 
      pkill -TERM -P $$
      clear
      if [ "$CURRENT" != "" ]
      then
        PREVIOUS=$CURRENT
        $IMAGE_VIEWER $COVERS_DIR/$CURRENT &
      else
        echo "::: NO COVER ART :::" 
        PREVIOUS=""
      fi
    fi   
    sleep 1
done