Previous 1 2 3 4 5 Next 74 Replies Latest reply: Jun 17, 2014 5:58 PM by Trane Francks Go to original post
  • batwing5 Level 1 Level 1

    For anyone wanting an application to do this without any hassle, I've combined softwater's latest script with the "Ask for Finder Items" Automator action and rolled up an application. Grab that here:

    For those who suspect suspicious downloads, it can be recreated in Automator with an "Ask for Finder Items" action followed by a "Run Shell Script" action containing the following:


    read -e WLPR;


    function change_wallpaper


    defaults write Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock




    Save as an application and you're ready to rock and roll.

  • Ludio Level 1 Level 1

    I've made the follwoing suggestion to Apple.  If others do the same, Apple might make the desired changes.


    'Hi. My suggestion concerns the efficient changing of desktop pictures for multiple desktops. I have four desktops with specific apps assigned to them, so I don't want to delete three of them, change the desktop picture on the one remaining, then re-create the other three and re-assign the apps to them. I also don't want to change each one individually. These options are too inefficient.


    It would be better if, when a picture is selected in the Desktop & Screen Saver pane of System Preferences, there were an option to apply it to more than one desktop. This would present a dropdown list of all created desktops, with a tickbox/checkbox next to each one's name, and an 'Apply to all' option at the top, so that the chosen desktop picture can be applied to only those desktops selected here. Alternatively, this list could appear automatically when the picture is selected.


    Perhaps the same could be applied to the selection of screen savers.


    Thank you.'

  • vanRijn Level 1 Level 1

    I was playing with this again today, not really happy with any of the solutions I've seen. I first started looking into python/appscript, which used to expose the internal bits necessary to do this, but I discovered that it's been discontinued. I did find some nice Applescript examples that led me down a different path. Here's what I've ended up with. And my apologies to the numerous people who came up with partial solutions to this... this has been cobbled together from their work, but I didn't keep track of all the parts.


    This Applescript (I saved mine as ~/bin/changeBackground.scpt) will prompt you for a new background image, then it will iterate through all your spaces and per each space iterate through all monitors and set the background image. I have 8 spaces, for example, so this script will prompt me for a new background image and then switch to desktop 1, change both right and left monitor backgrounds, and then switch to desktop 2 and so on. This is only the second time I've tried playing with Applescript at all, so there's probably some things I'm not doing right, but thus far, this seems to be working better than the other options I've tried!


    It's still a little goofy because it requires actually flipping through the spaces (at least it's automated!) while it changes the  background for each space. And this particular implementation requires the user to manually set how many desktops they have, as well as the keybinding that takes you to desktop 1 as well as the keybinding for "move right a space". I would LOVE to see this Applescript enhanced so it doesn't require that to be changed per individual user. And this script requires "enable access for assistive devices" to be set under Universal Access.


    But anyway... disclaimers aside, I'd love to hear comments, etc. =:)




    -- pick a new background image

    set theFile to choose file


    -- Find out how many spaces/desktops you have (this doesn't work on Lion?):

    tell application "System Preferences"

        reveal anchor "shortcutsTab" of pane id ""

        tell application "System Events" to tell window "Keyboard" of process "System Preferences"

            set numSpaces to count (UI elements of rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1 whose name begins with "Switch to Desktop")

        end tell


    end tell


    log numSpaces


    -- the above doesn't work, apparently, so set the number of spaces/desktops manually

    set numSpaces to 8


    log numSpaces



    -- Loop through the spaces/desktops, setting each of their backgrounds in turn:

    -- *Note*: Set your keyboard shortcut for desktop 1 if it's different

    tell application "System Events" to key code 18 using {command down} -- Desktop 1


    repeat (numSpaces) times


        -- Now loop through each monitor (confusingly called desktop) and change its background

        tell application "System Events"

            set monitors to a reference to every desktop

            set numMonitors to count (monitors)

            log numMonitors

            repeat with monitorIndex from 1 to numMonitors by 1

                set picture of item monitorIndex of the monitors to theFile

            end repeat

        end tell


        delay 1


        -- switch to the next desktop

        -- *Note:* Set your keyboard shortcut for "next desktop" if it's different

        tell application "System Events" to key code 124 using {command down, control down} -- ⌘→

        delay 1

    end repeat

  • dahveed Level 1 Level 1

    Quick Fix!


    If you have have 16 desktops and you have different apps assigned to all of them—like me—then you may not want to delete and re-add all of the desktops! As far as I know, you'll have to reassign them. Here's a quick fix:


    Open up Change Desktop Background by right clicking on any desktop. Change to the desktop you want. Now, while Change Desktop Background is still open, go into Mission Control mode (F7 on my laptop) and move the Change Desktop Background dialogue box to the next desktop that you want to change. I changed all my backgrounds in about 2 minutes! :-)

  • SandersKY Level 1 Level 1

    Well I read through this thread and decided there needs to be an easier way so I developed a Preference Pane to make this easy. The code for this Preference Pane is Open Source so you are more than welocme to look at the source and modify to your hearts content. Read more about it here (This page has a link to the GitHub repository for those who want the source code).

  • vanRijn Level 1 Level 1

    Just wanted to say thanks very much for doing this, SandersKY! I'm going to look at the source code, try to build this, and try to get it working with multiple monitors. I'll ask you more questions via github or your blog, but I just wanted to say thanks here too. =:)

  • vanRijn Level 1 Level 1

    Hm. I just looked at the source code and you're setting the wallpaper by running this shell command:


    defaults write Background '{default = {ImageFilePath = "<image chosen>"; }; }' && killall Dock"


    I was hoping you'd found some Cocoa API's to actually change the wallpaper directly. Are you still working on improving this? Or does anyone on this long thread know if there are Cocoa API's to set the wallpaper for a desktop space?

  • mmccrr Level 1 Level 1

    Cool! It works. Thanks a lot.

  • Chevex Level 1 Level 1

    Why do all the awesome scripts/apps linked here 404 already? It hasn't even been that long...


    I was hoping to use SandersKY's open-source solution but his link is down too and he provided no links to the github project from this thread, only from the web page that is now down. ARG this is so annoying! I'm using OS X Mavericks and this is STILL broken. I'm beginning to think I just need to use that stupid default Mavericks wallpaper and stop trying to customize my OS in order to save myself some frustration.

  • SandersKY Level 1 Level 1

    Sorry about that my hosting apparently didn't auto-renew. Fixed that issue. Also in case it messes up again here is a direct link to the Git repository.

  • aaanen Level 1 Level 1

    My easiest, just a click per space:


    1. set space #1 with the new desktop background you prefer for all.

    Next (swipe 4 fingers up) to Mission Control:

    2. add a new space        (which will appear with the new BG)

    3. swipe towards it         (swipe 4 fingers right towards it)

    4. and delete space #2   (all applications from that space #2 do move to the newly made space)

    Have a moment of 'wow', donate much money to my account, and/or honor me in your daily prayers.

    No need to re-order the spaces, just repeat steps 2-5 to replace all other old spaces.




  • Ludio Level 1 Level 1

    Perhaps some will find your suggestion useful, although it's inefficient to delete and create desktops just for changing the background. The problem for me is that the apps I have set to open in certain desktops would have to be reset to do so.  This adds to the inefficency, when all I want to do is apply one background to all desktops.



  • aaanen Level 1 Level 1

    You gave it a try? You will see that all apps will stay open and at the same spot on the space. You will see the apps moving from the deleted space to the selected space. (at least I'm talking about Lion OSX)

  • Ludio Level 1 Level 1

    I tried it but not with the apps open; I'd have to open too many and it would be inefficient just to change the desktop background. I deleted only one of the desktops after creating one, and then found that the apps that had been set to open on the now deleted one were not set to open on its replacement desktop.


    Perhaps I should have done it with all of the desktops instead of just one, but I didn't want to have the trouble of re-assigning all the apps to their different desktops.


    Also, I'm using Mavericks, not Lion, so maybe that makes a difference.


    Thanks anyway.

  • Trane Francks Level 2 Level 2

    computerfox wrote:


    My bad. Here's a link to the dmg- Enjoy!


    Kaspersky Internet Security flags this site as delivering malware. It may be a false positive, but I thought it worth mentioning.

Previous 1 2 3 4 5 Next