zsh and rc file abstract
[dotfiles.git] / Scripts / mpd-change
1 #!/bin/sh
2
3 # sends a notification on mpd song change :>
4
5 playing="$(mpc current)"
6
7 while true
8 do
9     # block until song change
10     mpc idle player > /dev/null
11     
12     # make sure the song acc changed
13     cur_song="$(mpc current)" 
14     [ "$cur_song" = "$playing" ] && continue;
15
16     playing="$cur_song"; 
17     [ -z "$cur_song" ] && continue; # don't send notify if no song tho
18
19     out="${cur_song%.*}" # get rid of extension
20     notify-send "Now Playing: ${out##*/}" -i "" # get rid of dir
21
22 done
23