applescript to set a wallpaper on all virtual desktops/spaces

Hello everybody,


i just want to share something i came up with after trying many things to set a wallpaper to every of my virtual desktops/spaces... feel free to use and improve it!


This applescript is based on a few solutions i found on the internet...


It's really silly, but all the other things doesn't work for me.


FIRST make sure that AppleScript Editor.app is checked in

System Preferences --> Security & Privacy --> Privacy --> Accessibility


Then start AppleScript Editor and paste the following:


----- snip -----

set myWallpaper to "/path/to/image.jpg"

set myNumberOfSpaces to 5


-- switch to first space

tell application "System Events" to key code 18 using control down

delay 1

tell application "System Events" to set picture of current desktop to myWallpaper

delay 0.5


repeat with theIncrementValue from 2 to myNumberOfSpaces


-- switch to next space

tell application "System Events" to key code 124 using control down


delay 1

tell application "System Events" to set picture of current desktop to myWallpaper

delay 0.5

end repeat

----- snip -----


Adjust the two variables to your needs...

e.g. i have 5 virtual desktops/spaces


Then click the Run button and watch it working :-)


Hopefully this will help someone.


I think you can easylie make an osascript or o droplet out of this...

Till now i found no other working shiny easy solution of setting one picture to all my desktops in mavericks.

Improvements are welcome!


woodst0ck

OS X Mavericks (10.9)

Posted on Dec 15, 2013 7:43 PM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

applescript to set a wallpaper on all virtual desktops/spaces

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.