WeatherDesk icon indicating copy to clipboard operation
WeatherDesk copied to clipboard

OS X change wallpaper on all desktops

Open cjohnston1158 opened this issue 8 years ago • 6 comments

On OS X, running this will only change the wallpaper on the active desktop. Would be awesome to see it change the wallpaper on all desktops.

cjohnston1158 avatar Feb 17 '17 12:02 cjohnston1158

I thought this was done by:

 OSX_SCRIPT = '''tell application "System Events"
                                  set desktopCount to count of desktops
                                    repeat with desktopNumber from 1 to desktopCount
                                      tell desktop desktopNumber
                                        set picture to POSIX file "%s"
                                      end tell
                                    end repeat
                                end tell
                              ''' % image

Which seems to do it to all desktops ... apparently not. Can you provide code for all desktops?

bharadwaj-raju avatar Feb 17 '17 13:02 bharadwaj-raju

I can't, no. Maybe the original author of that change could?

cjohnston1158 avatar Feb 18 '17 01:02 cjohnston1158

Working on something similar here (getspace.py) – just found your repo, maybe we can cooperate on some things (will definitely be borrowing from your Linux functions after having had a comparable general idea).

With regards to this issue: that AppleScript bit is actually not really working as it used to. As you can see, – after reading this – we are using a sqilte cmd at the moment (although that uses killall Dock, which is annoying if happening regularly).

Any other ideas/experiences?

jnshnz avatar Mar 14 '17 20:03 jnshnz

Does killall Dock have a noticeable impact?

bharadwaj-raju avatar Mar 15 '17 07:03 bharadwaj-raju

@bharadwaj-raju yes, it does, though it is somewhat negligible (some GUI effects will be disturbed/reset system wide for a brief instance, but no saved stuff will be deleted as far is I know).

I am researching the behavior of the sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "UPDATE data SET value='{}'" && killall Dock-bit a little further, also because it is not reliable in a (changing) multi display environment.

Will let you know if I come up with something.

jnshnz avatar Mar 17 '17 00:03 jnshnz

@jnshnz Then how does OS X do it through the GUI (which, I assume, causes no disturbance)?

Does Dock have a --reload or similar option? Or in AppleScript (imaginary: tell application Dock to reload settings)

bharadwaj-raju avatar Mar 18 '17 08:03 bharadwaj-raju