Skip to content

Instantly share code, notes, and snippets.

@gfontenot
Created July 7, 2011 18:02
Show Gist options
  • Save gfontenot/1070118 to your computer and use it in GitHub Desktop.
Save gfontenot/1070118 to your computer and use it in GitHub Desktop.
Ruby script to change the desktop to a new image on Mac OSX
#!/usr/bin/env ruby
def change_desktop image_path
`osascript <<EOD
tell application "Finder"
set theFile to POSIX file "#{image_path}"
set desktop picture to theFile
end tell
EOD
`
end
image_path = "#{Dir.pwd}/#{ARGV[0]}"
change_desktop image_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment