X-Git-Url: https://git.danieliu.xyz/?p=dotfiles.git;a=blobdiff_plain;f=Scripts%2Fmpd-change;fp=Scripts%2Fmpd-change;h=470dcb7765c6f2cf4620ba4d8d6cb2fcc63ade2b;hp=0000000000000000000000000000000000000000;hb=6b58ea8b8d9799698f147e5677b4b6e6d47a7e9d;hpb=f7b515eabe10128f2e478e6ec16e387467d8d6a4 diff --git a/Scripts/mpd-change b/Scripts/mpd-change new file mode 100755 index 0000000..470dcb7 --- /dev/null +++ b/Scripts/mpd-change @@ -0,0 +1,24 @@ +#!/bin/sh + +# sends a notification on mpd song change :> + +playing="$(mpc current)" + +while true +do + # block until song change + mpc idle player > /dev/null + + # make sure the song acc changed + cur_song="$(mpc current)" + [ "$cur_song" == "$playing" ] && continue; + + playing="$cur_song"; + + [ -z "$cur_song" ] && continue; # don't send notify if no song tho + + out="${cur_song%.*}" # get rid of extension + notify-send "Now Playing: ${out##*/}" -i "" # get rid of dir + +done +