Skip to content

Instantly share code, notes, and snippets.

@cal97g
Created February 25, 2019 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cal97g/8d6ab753f6b36372b7a2ce53d94d007e to your computer and use it in GitHub Desktop.
Save cal97g/8d6ab753f6b36372b7a2ce53d94d007e to your computer and use it in GitHub Desktop.
Update your wallpaper with album art on new track
ORIGINAL_WALLPAPER="/home/callam/Pictures/papes/wallhaven-712747.jpg"
#This is the actual script, modify the options you want
if ! cmus-remote -C >/dev/null 2>&1 ; then
echo >&2 "cmus is not running"
exit 1
fi
echo "its running"
info=$(cmus-remote -Q)
state=$(echo "$info" | sed -n 's/^status //p')
if [ "$state" = "stopped" ]||[ "$state" = "paused" ] ; then
gsettings set org.gnome.desktop.background picture-uri file://$ORIGINAL_WALLPAPER
echo >&2 "no song playing currently, aborting!"
exit 1
fi
rm file.jpg
file=$(echo "$info" | sed -n 's/^file //p')
ffmpeg -i "$file" file.jpg
imgh=$(identify -format "%h" $ORIGINAL_WALLPAPER)
screenres=$(xrandr | grep '*' | awk {'print $1'})
screenres=$(echo $screenres | cut -c6-9)
echo $screenres
factor=$(awk "BEGIN {print $screenres/$imgh}")
echo $factor
convert -resize 350x350 file.jpg file.jpg
convert -gravity SouthEast -geometry +40+120 $ORIGINAL_WALLPAPER file.jpg -composite result.jpg
gsettings set org.gnome.desktop.background picture-uri file://$PWD/result.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment