helm/shell/mpd/bin/notify-song

22 lines
518 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
if ! pgrep mpd >/dev/null; then
>&2 echo "mpd isn't running."
exit 1
fi
2016-12-25 21:27:25 -08:00
info=$(mpc -h "$HOME/.config/mpd/mpd.sock" current)
if [[ -z $info ]]; then
>&2 echo "nothing is playing."
exit
fi
case $OSTYPE in
darwin*)
terminal-notifier -title "Now playing" -message "$info" -appIcon "/Applications/iTunes.app/Contents/Resources/iTunes.icns"
;;
linux*)
notify-send --icon="media-playback-start" --app-name="ncmpcpp" "Now playing" "$info"
;;
esac