aboutsummaryrefslogtreecommitdiffstats
path: root/mpdnotify/run
blob: 24d46f5c9e76980a14c972d63e312ad3ad1f8ff6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# make sure mpd is running
sv check "$SV/mpd" > /dev/null || exit 1

# set DISPLAY environment variable so notify send doesn't complain
export DISPLAY=:0

[ -f ./conf ] && . ./conf || exit 1

while
  song="$(mpc current --wait)"
  rm -f "$coverartfile" # remove old coverart file

  if [ $coverart -eq 1 ]; then
    ffmpeg -y -i "$musicdir/$(mpc -f %file% | head -1)" "$coverartfile" &&\
    notify-send -i "$coverartfile" -r $ID "Now playing" "$song"
  else
    notify-send -r $ID "Now playing" "$song"
  fi
do :; done