This is a little program that when invoked with a given directory path as its parameter, it fetchs a random comic from xkcd's website and saves it into that directory. I use it in my Mac in conjunction with GeekTool and Automator to set a random comic as my desktop's background each time I do a system reboot.
- Install GeekTool
- Download xkcd_fan.py script
- Open GeekTool and create an Image Geeklet in your desktop. Set URL to the directory where you will save the comics and check Pick random image in directory
With that in place, all that's left to do is create an Automator application:
- Open Automator and choose new Application workflow
- Drag a "Run Shell Script" action to the workflow area in the right
- Set the Shell drop-down to /bin/bash and the Pass Input drop-down to as arguments
- Clear the text in the text box and write something like this (but using your own paths): /path/to/python3 /path/to/xkcd_fan.py /destination/directory
- Save it and test it running it clicking in the play button in the up-right corner
- Then, from the System Preferences >> User & Groups >> Login Items click in the + button and navigate to and select your new Automator application.
Only compatible with Python 3 right now but is not particulary hard adapt it so that works in Python 2 too.