Skip to content

Instantly share code, notes, and snippets.

@adiabatic adiabatic/chbg.sh
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.