Skip to content

Instantly share code, notes, and snippets.

@orand
Created November 3, 2023 04:25
Show Gist options
  • Save orand/df7806c3ff666605fed35912d46770b4 to your computer and use it in GitHub Desktop.
Save orand/df7806c3ff666605fed35912d46770b4 to your computer and use it in GitHub Desktop.
Update macOS Sonoma video screensaver and wallpaper based on a saved wallpaper Index.plist file
#!/bin/bash
# Check if an argument is given
if [ "$#" -ne 1 ]; then
echo "Usage: $0 path/to/file.plist"
exit 1
fi
# Store the path to the input .plist file
input_plist="$1"
# Define the destination path
destination_plist="$HOME/Library/Application Support/com.apple.wallpaper/Store/Index.plist"
# Check if the input .plist file exists
if [ ! -f "$input_plist" ]; then
echo "Error: File '$input_plist' does not exist."
exit 1
fi
# Copy the .plist file to the destination
cp "$input_plist" "$destination_plist"
# Check if the copy operation was successful
if [ $? -eq 0 ]; then
echo "File copied successfully."
else
echo "Failed to copy file."
exit 1
fi
killall WallpaperAgent
echo "WallpaperAgent has been restarted."
@orand
Copy link
Author

orand commented Nov 3, 2023

To use, save this script to a file and give it execute permissions using the command chmod +x update_sonoma_wallpaper.sh.

Then, for each wallpaper/screensaver you want to be able to switch to, select the appropriate screen saver in System Settings > Screen Saver, and copy the updated Index.plist file found at ~/Library/Application Support/com.apple.wallpaper/Store/Index.plist to a folder somewhere, renaming the copy to something more descriptive, such as Sonoma Horizon.plist.

You can save as many screensaver .plist configs as you want this way, and then switch to the one you want by running the script like this: ./update_sonoma_wallpaper.sh Sonoma\ Horizon.plist, assuming the script is located in the same folder as the saved plist files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment