Created
September 20, 2011 15:11
-
-
Save jerodsanto/1229361 to your computer and use it in GitHub Desktop.
MacRuby script to set wallpaper on all connected monitors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env macruby | |
abort "Usage: #{__FILE__} [image]" if ARGV.empty? | |
framework "Cocoa" | |
wallpaper_path = File.expand_path(ARGV.first) | |
wallpaper_url = NSURL.fileURLWithPath(wallpaper_path, isDirectory: false) | |
workspace = NSWorkspace.sharedWorkspace | |
NSScreen.screens.each do |screen| | |
workspace.setDesktopImageURL(wallpaper_url, forScreen:screen, options:nil, error:nil) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't find an easy way to loop this over all desktops in Mission Control. I toyed with sending keystrokes to trigger desktop switching, a la this app, but didn't get it working on first attempt.