This is a simple console application for macOS to create the dynamic wallpapers introduced in macOS Mojave. Here you can watch how dynamic wallpapers work. Also, you can read more about dynamic wallpapers in the following articles:
- macOS Mojave dynamic wallpaper
- macOS Mojave dynamic wallpapers (II)
- macOS Mojave dynamic wallpapers (III)
Below you can download prepared dynamic wallpapers:
You need to have the latest Xcode (10.2) and Swift 5 installed.
Open your terminal and run the following commands.
brew tap mczachurski/wallpapper
brew install wallpapperOpen your terminal and run the following commands.
$ git clone https://github.com/mczachurski/wallpapper.git
$ cd wallpapper
$ swift build --configuration release
$ sudo cp .build/release/wallpapper /usr/local/bin
$ sudo cp .build/release/wallpapper-exif /usr/local/binIf you are using Swift version 4.1, please edit the Package.swift file and put your version of Swift (on the first line).
Also, you can build using the build.sh script (it uses swiftc instead of the Swift CLI).
$ git clone https://github.com/mczachurski/wallpapper.git
$ cd wallpapper
$ ./build.sh
$ sudo cp .output/wallpapper /usr/local/bin
$ sudo cp .output/wallpapper-exif /usr/local/binNow in the console you can run wallpapper -h and you should get a response similar to the following one.
wallpapper: [command_option] [-i jsonFile] [-e heicFile]
Command options are:
-h show this message and exit
-v show program version and exit
-o output file name (default is 'output.heic')
-i input .json file with wallpaper description
-e input .heic file to extract metadataThat's all. Now you can build your own dynamic wallpapers.
If you get an error during the Swift build portion of the install, try downloading the entire Xcode IDE (not just the tools) from the App Store. Then run
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer and run the installation command again.
If you have done the above commands, now you can build a dynamic wallpaper. It's really easy. First, you have to put all your pictures into one folder and, in the same folder, create a json file with the pictures' descriptions. The application supports three kinds of dynamic wallpapers.
For a wallpaper that is based on solar coordinates, the json file has to have a structure like the snippet below.
[
{
"fileName": "1.png",
"isPrimary": true,
"isForLight": true,
"altitude": 27.95,
"azimuth": 279.66
},
{
"fileName": "2.png",
"altitude": -31.05,
"azimuth": 4.16
},
...
{
"fileName": "16.png",
"isForDark": true,
"altitude": -28.63,
"azimuth": 340.41
}
]Properties:
fileName- name of the picture file (you can use the same file for a few nodes).isPrimary- information about the image that is the primary image (it will be visible after creating theheicfile). Only one of the files can be primary.isForLight- iftrue, the picture will be displayed when the user chooses "Light (static)" wallpaperisForDark- iftrue, the picture will be displayed when the user chooses "Dark (static)" wallpaperaltitude- is the angle between the Sun and the observer's local horizon.azimuth- that is the angle of the Sun around the horizon.
To calculate proper altitude and azimuth, you can use the wallpapper-exif application or a web page: https://gml.noaa.gov/grad/solcalc/azel.html or https://www.omnicalculator.com/physics/sun-angle. On the web page, you have to enter the place where you take a photo and the date. Then the system generates for you the altitude and azimuth of the Sun during the whole day.
For a wallpaper that is based on the OS time json file have to have a structure like the snippet below.
[
{
"fileName": "1.png",
"isPrimary": true,
"isForLight": true,
"time": "10:25:43"
},
{
"fileName": "2.png",
"time": "14:32:12"
},
{
"fileName": "3.png",
"time": "18:12:01"
},
{
"fileName": "4.png",
"isForDark": true,
"time": "20:10:45"
}
]Properties:
fileName- name of picture file (you can use the same file for a few nodes).isPrimary- information about the image that is the primary image (it will be visible after creating theheicfile). Only one of the files can be primary.isForLight- iftrue, the picture will be displayed when the user chooses "Light (static)" wallpaperisForDark- iftrue, the picture will be displayed when the user chooses "Dark (static)" wallpapertime- time when wallpaper will be changed (most important is hour).
For wallpapers based on OS appearance settings (light/dark), we have to prepare a much simpler JSON file, and we have to use only two images (one for light and one for dark theme).
[
{
"fileName": "1.png",
"isPrimary": true,
"isForLight": true
},
{
"fileName": "2.png",
"isForDark": true
}
]Properties:
fileName- name of the picture file.isPrimary- information about the image that is the primary image (it will be visible after creating theheicfile). Only one of the files can be primary.isForLight- iftrue, the picture will be displayed when the user uses the light themeisForDark- iftrue, the picture will be displayed when the user uses the dark theme
When you have a json file and all pictures, then you can generate a heic file. You have to run the following command:
wallpapper -i wallpapper.jsonYou should get a new file: output.heic. Set this file as a new wallpaper and enjoy your own dynamic wallpaper!
You can extract metadata from an existing heic file. You have to run the following command:
wallpapper -e Catalina.heicMetadata should be printed as output on the console.
Also, it's possible to extract and save the whole plist file:
wallpapper -e Catalina.heic -o output.plistIf your photos contain GPS Exif metadata and creation time, you can use the wallpapper-exif application to generate a json file with Sun altitude and azimuth. Example application usage:
$ wallpapper-exif 1.jpeg 2.jpeg 3.jpegjson should be produced as output on the console.
Sun calculations have been created based on the JavaScript library created by Vladimir Agafonkin (@mourner).


