Unsplashy background images

I'm so sick of MacOS's default background images. They're pretty, I've just seen them all so many times now.

Uuuuuggghhh

So in the spirit of Sam's daily prototypes I decided to do something about it. Enter Unsplash - a service / platform / thing with a huge database of completely free, beautiful photos.

Oh, and it has an API. Here's a random nature photo!

MacOS supports pulling desktop wallpapers from a directory. So I wrote a script that pulls down a random featured image in each category I like. Most of the logic is for figuring out a good (stable) filename and discarding already-downloaded images.

Finally I added a launchctl plist which runs the script every 6 hours. Eventually my directory will be huge, but I can tweak the script manually when that happens.

So now my secondary display shows a beautiful space lady in space. Being surprised is delightful.

If you want the same great experience, right now you need to:

git clone https://github.com/josephg/unsplash.git  
cd unsplash  
npm install -g .  
cp unsplash.plist ~/Library/LaunchAgents/  
launchctl load ~/Library/LaunchAgents/unsplash.plist  

By default it'll download images at 2560x1440 in the 'buildings', 'food', 'nature', 'objects' and 'people' categories. They get saved to ~/unsplash in your home directory. Tweak the script directly if you like.

Run unsplash-get a few times to kick it off and make sure its working.

I could automate all of that, but I'm not going to. I could have used the official nodejs unsplash library, but I didn't and I don't care because its working for me now.

Have fuuuun!