bharadwaj-raju / WeatherDesk

MOVED: https://gitlab.com/bharadwaj-raju/WeatherDesk
https://gitlab.com/bharadwaj-raju/WeatherDesk
GNU General Public License v3.0
217 stars 31 forks source link

OS X change wallpaper on all desktops #34

Open cjohnston1158 opened 7 years ago

cjohnston1158 commented 7 years ago

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.

bharadwaj-raju commented 7 years ago

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?

cjohnston1158 commented 7 years ago

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

jnshnz commented 7 years ago

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?

bharadwaj-raju commented 7 years ago

Does killall Dock have a noticeable impact?

jnshnz commented 7 years ago

@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.

bharadwaj-raju commented 7 years ago

@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)