Created
February 25, 2019 18:41
-
-
Save cal97g/8d6ab753f6b36372b7a2ce53d94d007e to your computer and use it in GitHub Desktop.
Update your wallpaper with album art on new track
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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