Random Unsplash Wallpapers For Ubuntu
I like to have random wallpapers while working on PC, a kind of window opened to the world. Now add to that a set of wonderful and free pictures from Unsplash, and you’ll need nothing else to stay happy and motivated!
For Windows, there are tools that do that we no big deal, like DMT.
For Ubuntu, I didn’t find such tool, so I’m tweaking something here (that’s Linux power :))
Thanks to Unsplash.it and this post, I have enough help to start. It already uploads random picture and set it as wallpaper.
#/bin/bash wget -O /tmp/wallpaper.jpg https://unsplash.it/2560/1440/?random gsettings set org.gnome.desktop.background picture-uri file:///tmp/wallpaper.jpgCreate a script with above code (I’m doing it in /bin folder):cd /bin
sudo nano unsplash.sh
Ctrl+X, then Y, then Enter.
Make it executable, and run it:sudo chmod +x unsplash.sh
./unsplash.sh
You’ll see after some seconds that the wallpaper changes to a new one.
If nothing happens or you lost the previous one, it is may be a problem of connection
Now let’s execute it every 5 minutes using crontab, edit it:crontab -e
Choose an editor with its number, then add at the end the line:*/5 * * * * /bin/unsplash.sh
Ctrl+X, then Y, then Enter.
Here is a good explanation of crontab syntax, I quote the part:
The stars represent different date parts in the following order:
- minute (from 0 to 59)
- hour (from 0 to 23)
- day of month (from 1 to 31)
- month (from 1 to 12)
- day of week (from 0 to 6) (0=Sunday)
It means every 5 minutes, every hour, every day, and every month.
For the moment this basic script works fine 🙂
If you have any remark or suggestion please add a comment. Thank you.
Originally published at youness.net on August 27, 2017.
