I have an 11" Air so I usually run all of my open applications in fullscreen mode. I have a launchd
job for my user that runs a script every hour and every login to set the desktop background according to time of day. The problem is that, despite running in the background, unless I am logging in or idling on the Desktop "space", it will not get set.
Weirdly, it also changes to dark mode at night (or light mode during daytime) and that part of the script works just fine.
So, if I go to my fullscreen'd Terminal.app
and run the following lines, they do not work to change the desktop background:
osascript -e "tell application \"Finder\" to set destop picture to POSIX file \"<path>\""
or
osascript -e "tell application \"System Events\" to set picture of every desktop to \"<path>\""
or even
tell application "System Events"
set desktopCount to count of desktops
repeat with desktopNumber from 1 to desktopCount
tell desktop desktopNumber
set picture to "<path>"
end tell
end repeat
end tell
Does anyone know how to get this to work?