moc-notify.sh 539 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. msgId="291011"
  4. if [[ ! $(pidof mocp) ]]; then
  5. echo "mocp is not running..."
  6. exit 2
  7. fi
  8. cover-music-generate.sh "$(mocp --format %file)" "${1:-200}"
  9. sleep 0.2
  10. tags=$(mocp --info | sed '11d;10d;9d;3d;2d' | \
  11. sed 's/ /\t/' | column -t -s $'\t')
  12. title='mocp-notifier'
  13. notify-send -i "/tmp/cover.png" "$title" "$tags"
  14. # dunstify -i "/tmp/cover.png" -r "$msgId" "$title" "$tags"
  15. # set this in moc config
  16. #OnSongChange = /absolute/path/moc-notify.sh
  17. #RepeatSongChange = yes