desktop-playbook/files/config/cmus/notify.sh

37 lines
540 B
Bash
Executable file

#!/bin/bash
#
#CMUS notification
#
set -x
body=""
while [ "$#" -ge 2 ]
do
eval $1='$2'
shift
shift
done
filename=${file#*/}
image=${file%/*}/cover.jpg
[ -f "$image" ] && options="$options -i \"${image}\""
title=${title:-$filename}
if [ -n "$artist" ]
then
body="$body <i>$artist</i>\n"
fi
if [ -n "$album" ]
then
body="$body $album"
fi
if [ -n "$date" ]
then
body="$body ${date%%-*}"
fi
body=${body:-'no informations'}
echo "$options" > ~/cmus.txt
notify-send --app-name=cmus -i "$image" "$title" "$body" > ~/cmus.txt