Ever wanted your wallpaper to be the newest image from Miley Cyrus' Instagram?
Well i did, so i hacked up a little script to pull the newest image and set it as my wallpaper in my Cinnamon on Linux Mint.
#!/bin/bash
# retrieves newest image from instagram account
# and sets this as desktop background in cinnamon
#
instagram="https://www.instagram.com/mileycyrus/"
wallpaper="/tmp/mileycyrus.jpg"
#regex black magic
url=$(wget $instagram -q -O -|grep '"nodes"'|sed 's/.*nodes//'|sed 's/","is_video":false,.*//'|sed 's/.*:"//'|sed 's/\\//'g|sed 's/\(https:\/\/\([^\/]\+\/\)\{3\}\)\([^\/]\+\/\)\{2\}/\1/')
if [ "$url" == "" ];then
echo "no url found"
exit
fi
wget $url -q -O $wallpaper
if [ -e "$wallpaper" ]; then
gsettings set org.cinnamon.desktop.background picture-uri "file://$wallpaper"
fi
Feel free to download and change this script as you wish, you may have to google, to adapt the wallpaper changing to your desktop environment. I myself had a little help from unix.stackexchange [1].
If you want to set it up as a cronjob, please remember, that you have to set the DISPLAY variable for that to work. See the following entry to my crontab, which runs the script every hour as example.
41 * * * * DISPLAY=:0 /home/username/crazy_scripts/miley.sh
Download: miley.sh
[1] | http://unix.stackexchange.com/questions/59653/change-desktop-wallpaper-from-terminal |
Comments !