aboutsummaryrefslogtreecommitdiffstats
path: root/mpdnotify/run
blob: 6f4c92969dd6e6032632c6ab352ed21d9e30f002 (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 "$HOME/.local/share/service/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)"

  if [ $coverart -eq 1 ]; then
    ffmpeg -y -i "/mnt/hdd/moosic/$(mpc -f %file% | head -1)" "$coverartfile" &
    timeout 3 inotifywait -e close "$coverartfile"
    notify-send -i "$coverartfile" -r $ID "Now playing" "$song"
  else
    notify-send -r $ID "Now playing" "$song"
  fi
do :; done