Free DIY Bing Desktop Wallpaper for Apple Mac

I am sure everyone would agree that every images featured on Bing.com are nothing short of being breathtaking. On all my PCs, notebooks, my Android phones and even my windows mobile phone, it is so easy to automatically download these images as wallpapers. I like to be greeted with awesome photos everytime I switch on the device.

On the Mac, however, it is not so straightforward. Maybe it is because Microsoft and Apple are not the best of friends? I don’t know. One can either go to the Appstore and buy an app such as this one here but I thought there must surely be a way to do this easily and most important of all, free. A quick exercise in google-fu rewarded me with a bunch of python scripts that can be adapted to the Mac OS.

The script I used are adapted from:

http://www.owenrumney.co.uk/2014/09/13/Update_Bing_Desktop_For_Mac.html.

All credits go to Owen Rumney of course. So I downloaded this python script and I thought why not bind this python script to an automator action. So that’s exactly what I did. I am doing everything on Yosemite 10.10.4 (on an old 24″ iMac 2007 I may add). I launched Automator and create a new workflow containing a “Run shell script” action. This looks like the following:

Screen Shot 2015-07-18 at 4.25.13 pm

The script in text form is as follows. Please make sure you give Owen Rumney the credit that is due to him. (Note: it looks like WordPress truncates some of the text so go to Owen’s website to see the full untruncated version)

# http://www.owenrumney.co.uk/2014/09/13/Update_Bing_Desktop_For_Mac.html

import os
import shutil
import urllib2
import json
from os.path import expanduser

dir_src = "/Users/norah/Pictures/new-bing-wallpapers"
dir_dst = "/Users/norah/Pictures/old-bing-wallpapers"

for file in os.listdir(dir_src):
 print file #testing purposes only
 src_file = os.path.join(dir_src, file)
 dst_file = os.path.join(dir_dst, file)
 shutil.move(src_file, dst_file)
 
response = urllib2.urlopen("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US")
obj = json.load(response)
url = (obj['images'][0]['urlbase'])
name = (obj['images'][0]['fullstartdate'])
url = 'http://www.bing.com' + url + '_1920x1080.jpg'
home = expanduser('~')
path = home +'/Pictures/new-bing-wallpapers/'+name+'.jpg'
print ("Downloading %s to %s" % (url, path))
f = open(path, 'w')
pic = urllib2.urlopen(url)
f.write(pic.read())

I name this Automator workflow as “GoBing” and I saved this on the desktop. How this script works is very simple. Here is a quick overview.

I have 2 folders in the Pictures folder called “new-bing-wallpapers” and “old-bing-wallpapers” respectively. The idea is that new wallpaper image will be automatically downloaded to “new-bing-wallpapers” folder but before we do this, we want to first move/backup the last one we downloaded to the folder “old-bing-wallpapers”. Obviously this is personal preference so one can modify this step or kill it to suit.

The next came the main script. I didn’t modify anything except the path to which the images will be downloaded. Everything is good to go. Now that the Automator workflow is complete, we need a way to launch the workflow action automatically. In my case I can just double click on the “GoBing” icon on my desktop and it will go fetch the latest wallpaper. To further automate this step, we will need to use some kind of task scheduler. In Mac, one can use Crontab, Launchd or even the Calendar. I don’t like any of these options. So I downloaded a free tool called “Task till Dawn” written by Oliver Matuschin. Setting up is extremely easy.

After installing the software, add a new task and configure the task as follows:

Screen Shot 2015-07-18 at 4.45.49 pm  Screen Shot 2015-07-18 at 4.53.26 pm

It looks to me that Bing update its images at around 4pm Australian Western Standard Time. So I set the task to be executed at 4.15pm everyday. Task Till Dawn will show a floating window that looks somewhat like this:

Screen Shot 2015-07-18 at 4.56.29 pm

The last step is to setup the “Desktop & Screen Saver” setting as follows. I set the time to refresh the wallpaper to per hour but that can be change if required.

Screen Shot 2015-07-18 at 5.00.50 pm

So that’s it. Now a new bing image will be automatically downloaded everyday and make that the desktop wallpaper. I hope this DIY method is helpful in any way :-)

Edit 2015.07.19

The script has been updated to reflect the correct region. These are the changes (marked in red):

I changed

"http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"

to

"http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-AU"