Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Summary. Automation changes desktop background for all (virtual) desktops, but no all monitors. How to do it for all monitors?

Details.

This blog entry discusses how to automatically change background for all (virtual / Mission Control / etc) desktops with following 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

However, it doesn't change the desktop background on my 2nd monitor on my Lion-based system for any of my Mission-Controlled desktops. How does one apply above (or similar) to all physical monitors? (Hacks like this unattractive.)

share|improve this question

2 Answers 2

I have dual monitor Mac at work so I will be able to give it a try tomorrow (day off today).

I think if you were to compare the output of:

$ defaults read com.apple.desktop

Before and after having manually changed the wallpaper via:

System Preferences > Desktop & Screen Saver > Desktop

That, should, bring up a window in the second display allowing you to select required image. Once that is setup and working, compare the output from the original command and see if it gives you any clues. I shall do the same tommorow and play around it with it. See if I can't give you a more complete answer.

share|improve this answer

I'm afraid this isn't a complete answer, since I haven't yet found a way to make this work with multiple desktops, but it will set the desktop of all monitors in the current space to whatever picture you specify.

on run {input, parameters}
    set theFile to first item of input
    tell application "System Events"
        set theDesktops to a reference to every desktop
        repeat with aDesktop in theDesktops
            set the picture of aDesktop to theFile
        end repeat
    end tell
    return theFile
end run

Add that to a Run AppleScript action in an Automator workflow, and save it as an application. You can then drag and drop an image onto the application and it will be set as the desktop image.

Perhaps someone can find a way to make this work with multiple spaces/desktops.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.