mission control - how do I change all my wallpapers

So Lion gives me the chance to have separate wallpapers per "space" or whatever we're calling them now. However, I don't really want to and the idea of changing 9 spaces wallpapers one at a time seems like a retrograde step not a move forward. Is there any way to change all of them at once?

MacBook, Mac OS X (10.7)

Posted on Jul 20, 2011 3:08 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 2, 2012 7:47 AM

atlaz wrote:


So Lion gives me the chance to have separate wallpapers per "space" or whatever we're calling them now. However, I don't really want to and the idea of changing 9 spaces wallpapers one at a time seems like a retrograde step not a move forward. Is there any way to change all of them at once?


You can do this in Terminal, if that doesn't scare you.


defaults write com.apple.desktop Background '{default = {ImageFilePath="/Library/Desktop\ Pictures/Lion.jpg"; };}'; killall Dock


If you copy the above command into Terminal and hit 'return', it should change all 9 of your desktops (or however many you've got) to the Lion.jpg. Of course, that's probably not what you want, but you can change it to the image you prefer just by changing the path between the quotes in {ImageFilePath="path to your file here" part.


Remember that if the folder name contains a space, like 'Desktop Pictures" you will need to put a \ before each space as in 'Desktop\ Pictures'. You can see this in the Lion example. If all the pictures you want to use are actually in the Desktop Pictures folder, then you can just copy the whole command above and just change the jpg name at the end (i.e., /Lion.jpg to /yourPic.jpg).


It shouldn't be that hard to write a simple Applescript to do this if anyone fancies experimenting, please share it here! 🙂

74 replies
Question marked as Top-ranking reply

Jul 2, 2012 7:47 AM in response to atlaz

atlaz wrote:


So Lion gives me the chance to have separate wallpapers per "space" or whatever we're calling them now. However, I don't really want to and the idea of changing 9 spaces wallpapers one at a time seems like a retrograde step not a move forward. Is there any way to change all of them at once?


You can do this in Terminal, if that doesn't scare you.


defaults write com.apple.desktop Background '{default = {ImageFilePath="/Library/Desktop\ Pictures/Lion.jpg"; };}'; killall Dock


If you copy the above command into Terminal and hit 'return', it should change all 9 of your desktops (or however many you've got) to the Lion.jpg. Of course, that's probably not what you want, but you can change it to the image you prefer just by changing the path between the quotes in {ImageFilePath="path to your file here" part.


Remember that if the folder name contains a space, like 'Desktop Pictures" you will need to put a \ before each space as in 'Desktop\ Pictures'. You can see this in the Lion example. If all the pictures you want to use are actually in the Desktop Pictures folder, then you can just copy the whole command above and just change the jpg name at the end (i.e., /Lion.jpg to /yourPic.jpg).


It shouldn't be that hard to write a simple Applescript to do this if anyone fancies experimenting, please share it here! 🙂

Nov 8, 2011 7:45 PM in response to dissolved

Right. I hit this too. I had previously set backgrounds for all my desktops individually. If you "open ~/Library/Preferences/com.apple.desktop.plist", you'll see that there is more than one Background definition. At first I tried to figure out which ones of these elements I could delete, and I failed. =:) I just removed ~/Library/Preferences/com.apple.desktop.plist, rebooted (probably could do something simpler here like "Killall Dock" or just logging out and logging back in again). Then I set the background for my first desktop, then did "Killall Dock" and saw that my background now appeared correctly on all desktops. Would really be nice for an "apply to all desktops" checkbox, though, totally agree.

Jul 2, 2012 10:39 AM in response to softwater

Here's the script:


#! /bin/bash

#script to change all desktop backgrounds


echo -n "Drag and drop an image file here then press 'return'...:"

read -e WLPR;


function change_wallpaper

{

defaults write com.apple.desktop Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock

}

change_wallpaper


This is what you do with it:


1. Copy the code above into a plain text editor. If you use TextEdit make sure it's not in .rtf format. My favourite free editor is Tincta.


2. Save the file as 'ChangeAllDesktops' in your ~/Desktop folder (be sure to remove the .txt ending).


3. In Terminal make the file executable by typing (or copy/paste):


chmod a+x ~/Desktop/ChangeAllDesktops


4. In Finder right-click the file and select "Open with" and then "Other...". Navigate to Terminal.app in /Applications/Utilities. It will be greyed out, so change "Recommended Applications" to "All Applications" in the menu at the bottom of the window. Do not check "Always Open With". Choose Terminal.app.


After clicking OK you should be able to execute it whenever you want by simply double-clicking it on the Desktop (of course you can move it to somewhere else, if you want).


When it runs, Terminal will open and ask you to drag an image file into the Terminal window. After doing so, press 'return'.


Desktops changed!

Jul 2, 2012 9:38 PM in response to vanRijn

Thanks, but the drag and drop thing is a bit annoying.


To make it a bit less inconvenient, move the file to


/Library/Desktop Pictures


(note: you will need to authenticate when prompted in order to save into the 'Desktop Pictures' folder),


then drag the folder 'Desktop Pictures' to the Finder sidebar to make a convenient shortcut.


Now when you want to change all Desktop images, click in 'Desktop Pictures' in the Finder sidebar, click this file, and drag image from the (already) open Finder window. If you save all your Wallpapers in this location then there'll all be in one spot and the window open when you run the program


I've changed the script slightly from above to include the escape sequence, as many people aren't familiar with Terminal, so what if...


1. I ran the script but now I don't want to use it?

If you change your mind or select the wrong file, you can use 'control-c' to kill the script without making the change. If you don't enter anything but press 'return', you'll change all the wallpapers back to the default galaxy pic, so the 'control-c' trick is worth knowing.


2. I dropped the wrong file onto Terminal?

If you drop the wrong file and want to chose another one, just keeping pressing the 'delete' key till its removed from the command line, then drop the correct file. Alternatively, you can still use 'control-c' to kill the script at any time before you hit 'return'.


Here's the slightly changed script:


#! /bin/bash

#script to change all desktop backgrounds


echo -n "Drag and drop an image file here then press 'return' or

press 'control-c' to cancel..."

read -e WLPR;


function change_wallpaper

{

defaults write com.apple.desktop Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock

}

change_wallpaper



###################

#after testing, save this program in /Library/Desktop Pictures

#drag the folder 'Desktop Pictures' to the Finder sidebar

#now when you want to change all Desktop images, click in 'Desktop Pictures'

#in Finder, click this file, and drag image from the open Finder window

#note: you will need to authenticate when prompted

#in order to save into the 'Desktop Pictures' folder

###################

Aug 28, 2012 6:55 AM in response to atlaz

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: http://www.2shared.com/file/Y-gLgRhX/Change_All_Desktops.html

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 com.apple.desktop Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock

}

change_wallpaper


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

Sep 25, 2012 3:19 PM in response to batwing5

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 "com.apple.preference.keyboard"

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

quit

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

Aug 23, 2011 3:33 AM in response to atlaz

To me its also like a downgrade feature.

But well, I use a workaround for this:


Since I need with every wallpaper certain areas for my GeekTool stuff I started to use one .psd file as wallpaper.

http://dl.dropbox.com/u/5905196/Screenshots/screen1.png

So whenever I want to change the wallpaper I just open the psd file and change the one layer.

By doing that the OS wallpaper is always the same: the psd file.

All I have to do after the in-file-change is lock the screen and log in again and all my spaces have the new background.


I guess this should work with every other image file also if you put your wallpapers always on the same spot with the same name and file extension.


Works fine for me.. at least better than changing the wallpaper for 8 spaces or deleting my spacing and setting them up again and assign all the apps to the spaces over and over..

Jul 2, 2012 9:48 AM in response to atlaz

First, if we are all lucky Apple fixed this in Mountain Lion, so it may make sense at this point to just wait until that comes out. But I like the approach of a script to solve this.


A while back when I first got Lion and upon the suggestion of someone else (I think early in this thread), I changed all my desktop backgrounds to point to the same image that I placed in a stationary folder and I named that image "desktop.png". When I want to change the background on all my desktops, I simply rename and/or convert the new image to "desktop.png" and place it in the stationary folder overwritting the old image. Do a "Killall Dock" command in terminal and I am done.


This works well for me but I took that a bit further since I know my way around PhotoShop and FireWorks and created one large image in that folder with the same name, "desktop.png" only with multiple layers (each layer being one of my favorite backgrounds). I then just turned on a single layer of whichever image I want for my desktop and save that. Again doing the "Killall Desktop" to apply the changes. This works better, but there is a definite limit to how many layers you can have as desktop backgrounds before PS or FW starts to crash.


So I was thinking that it would be nice if there was a script that - each time I moved a new image into the stationary folder - renamed the image in the stationary folder automatically to desktop.png (or whatever all your desktops are pointing to) and then ran the "Killall Dock" command. Then it would simply be a matter of dragging the desired background image into the stationary folder and running the script.

Oct 9, 2012 10:11 PM in response to atlaz

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! :-)

Jun 11, 2014 6:21 PM in response to atlaz

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.


Sincerely,

AAANEN

Nov 8, 2011 6:00 PM in response to vanRijn

killall Dock on Desktop 1 did not work for me. My other desktops remained unchanged.


I too have been bothered by this change, and hope for a "Apply to all desktops" button in the Desktop system preference someday in the future.


The best workaround I have is to assign System Preferences to appear on all spaces. Ctrl-arrow to a space, and it will be there, still open to the desktop pictures preference. You have to click a different image, and then click the one you want, and it will set the image on the new desktop.


I use six spaces, and it just takes a few seconds.

Mar 3, 2013 11:13 AM in response to atlaz

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

Feb 13, 2012 12:02 AM in response to atlaz

Mildly annoying, but the best way I have found is to open you desktop prefs and set it on one desktop, then drag the setting window to every desktop and select the picture you want. This way is actually probably the fastest and easiest, but still sorta lame.


EDIT: didn't realize this had already been said, sorry.

I do think apple should add a "apply to all desktops" button

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.

mission control - how do I change all my wallpapers

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