Things have been somewhat quite here of late?
Occasionally I like to set myself little mental exercises to keep the brain ticking over. My latest bright idea was to replace my desktop background wallpaper with a live [or nearly live] image from the Internet.
There is a site with a live webcam pointing to a view that I love. The webcam updates roughly once a minute producing a JPG image. My task was to use that image as a desktop background.
For the purposes of illustration, I have used imaginary URLs but you can take it from me that it works.
The first part was to write a shell script to retrieve the file from the website. This was short and simple –
# retrieves newest image from web camera
# and sets this as desktop background in cinnamon
wget "http://webcamerasite.com/webcams/cameraoutput.jpg" -O /home/username/Images/camera.jpg
gsettings set org.cinnamon.desktop.background picture-uri "file:///home/username/Images/camera.jpg"
Note that the final line is for Linux Mint Cinnamon edition. Modify it for other versions.
Save the script and make it executable. Running the script will replace the background image with the latest from the website.
The next task is to set up a Cron job to run the script.
In Terminal, type crontab -e
Select the editor (I chose 2 – Nano).
Add the following line at the bottom –
* * * * /home/username/location of shell script
This will run the script once a minute.
Press Ctrl-o to save the file, press Enter to confirm the file name and Ctrl-w to exit.
Your desktop will now refresh every minute with the latest view.
The latest image on my desktop