I would like to change the wallpaper on ALL desktops including spaces on Mac but without needing to call killall Dock
each minute. (Dock restarting forces wallpaper refresh).
I have an AppleScript that changes the desktop wallpaper instantly:
tell application "System Events" to tell every desktop to set picture to wallpaperPath
but that only changes the wallpaper on the active space (meaning that if the main desktop is not active, its background will not change).
I found this question How to loop through all Mac desktop spaces which suggests updating wallpaper path values in the SQLite database located at ~/Library/Application Support/Dock/desktoppicture.db
. This changes the wallpaper at every space which is great but it requires restart of the dock using killall Dock
which is undesirable as it disrupts the workflow.
My question is - is there some way to combine these two approaches? Seamlessly change wallpapers on every desktop space?
Any suggestions would be appreciated. I have no preferred language, it can be in C, Swift, Python, Bash, AppleScript etc.