Skip to content

Instantly share code, notes, and snippets.

@adiabatic
Last active August 29, 2015 14:12
Show Gist options
  • Save adiabatic/820c9d7902d508e1335e to your computer and use it in GitHub Desktop.
Save adiabatic/820c9d7902d508e1335e to your computer and use it in GitHub Desktop.
Change all backgrounds to either light or dark, depending.
case $1 in
light)
imageFile="/Library/Desktop Pictures/Solid Colors/Solid White.png"
;;
dark)
imageFile="/Library/Desktop Pictures/Solid Colors/Solid Gray Pro Ultra Dark.png"
;;
*)
imageFile=""
;;
esac
if test -f "$imageFile"; then
osascript << EOF
tell application "System Events"
set N to count of desktops
repeat with i from 1 to N
tell desktop i to set picture to POSIX file "$imageFile"
end repeat
end tell
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment