Applescript for changing the Mac OS X desktop picture based on the time of day
Switch branches/tags
Nothing to show
Clone or download
Latest commit fe51ee9 Apr 14, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
Time of Day Sample images Apr 26, 2013
.gitignore Added gitignore Apr 26, 2013 readme: fix headings Mar 3, 2018
wallpaper.scpt Updated date handling Jun 19, 2016


Applescript for changing the Mac OS X desktop picture based on the time of day

What it does

This is an AppleScript that changes your Mac's desktop picture based on the time of day. The day is split into six 'periods':

  • Morning Early (12:01am - 8:00am)
  • Morning Late (8:01am - 12:00pm)
  • Afternoon Early (12:01pm - 3:00pm)
  • Afternoon Late (3:01pm - 6:00pm)
  • Evening Early (6:01pm - 9:00pm)
  • Evening Late (9:01pm - 12:00am)

Each period has a corresponding folder, which is meant to store images that evoke the period in question. For example, you could have a picture of a sunset in the "Evening Early" folder, or a picture of the moon in the "Evening Late" folder.

/Users/YOUR_USER_NAME/Pictures/Wallpapers/Time of Day/Evening Early/sunset.jpg
/Users/YOUR_USER_NAME/Pictures/Wallpapers/Time of Day/Evening Late/moon.jpg

The script will randomly select an image from the corresponding folder. The image can be in any supported file type, including JPG, GIF and PNG images.

How to use it

Folder structure

If you choose to use the default settings, all you need to do is create folders in your Pictures folder that correspond to the following sample paths:

  • ~/Pictures/Wallpapers/Time of Day/Morning Early/
  • ~/Pictures/Wallpapers/Time of Day/Morning Late/
  • ~/Pictures/Wallpapers/Time of Day/Afternoon Early/
  • ~/Pictures/Wallpapers/Time of Day/Afternoon Late/
  • ~/Pictures/Wallpapers/Time of Day/Evening Early/
  • ~/Pictures/Wallpapers/Time of Day/Evening Late/


You must supply your own images. Personally, I downloaded images from, which provides high quality free wallpaper images.

Script file

This script file itself can be located anywhere. I keep mine in the /Pictures/Wallpapers/Time of Day/ folder.

The script must be run at specified intervals using automation of some kind. I use GeekTool, but you may also use a built-in service such as crontab.

I instruct GeekTool to execute the script every 15 minutes (1800 seconds). Use this line in GeekTool's command field:

osascript ~/Pictures/Wallpapers/Time\ of\ Day/wallpaper.scpt


This script can be freely customized. It is heavily commented to make it easy to understand. For example, you can easily change the specified times of day or folder names by editing the script. You can simplify to something such as "day" and "night", or get even more granular and specify a custom folder for each hour of the day.

Multiple monitors

The script includes support for multiple monitors. By default, it will display the same image on all monitors. If you prefer to set a unique image on each monitor, set the useSamePictureAcrossDisplays variable to false.